2021-10-10 10:37:57 +00:00
|
|
|
// edition:2018
|
|
|
|
|
fn require_static<T: 'static>(val: T) -> T {
|
2021-10-11 19:20:13 +00:00
|
|
|
//~^ NOTE 'static` lifetime requirement introduced by this bound
|
2021-10-10 10:37:57 +00:00
|
|
|
val
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Problem;
|
|
|
|
|
|
|
|
|
|
impl Problem {
|
|
|
|
|
pub async fn start(&self) { //~ ERROR E0759
|
|
|
|
|
//~^ NOTE this data with an anonymous lifetime `'_`
|
|
|
|
|
//~| NOTE in this expansion of desugaring of `async` block or function
|
2021-10-11 19:20:13 +00:00
|
|
|
require_static(async move { //~ NOTE ...and is required to live as long as `'static` here
|
|
|
|
|
&self; //~ NOTE ...is captured here...
|
2021-10-10 10:37:57 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {}
|