2022-05-21 14:46:25 -05:00
|
|
|
// ignore-compare-mode-nll
|
|
|
|
// revisions: base nll
|
|
|
|
// [nll]compile-flags: -Zborrowck=mir
|
|
|
|
|
2021-10-10 05:37:57 -05:00
|
|
|
// edition:2018
|
|
|
|
fn require_static<T: 'static>(val: T) -> T {
|
2022-05-21 14:46:25 -05:00
|
|
|
//[base]~^ NOTE 'static` lifetime requirement introduced by this bound
|
2021-10-10 05:37:57 -05:00
|
|
|
val
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Problem;
|
|
|
|
|
|
|
|
impl Problem {
|
2022-05-21 14:46:25 -05:00
|
|
|
pub async fn start(&self) {
|
|
|
|
//[base]~^ ERROR E0759
|
|
|
|
//[base]~| NOTE this data with an anonymous lifetime `'_`
|
|
|
|
//[base]~| NOTE in this expansion of desugaring of `async` block or function
|
|
|
|
//[nll]~^^^^ NOTE let's call
|
|
|
|
//[nll]~| NOTE `self` is a reference
|
|
|
|
require_static(async move {
|
|
|
|
//[base]~^ NOTE ...and is required to live as long as `'static` here
|
|
|
|
//[nll]~^^ ERROR borrowed data escapes
|
|
|
|
//[nll]~| NOTE `self` escapes
|
|
|
|
//[nll]~| NOTE argument requires
|
|
|
|
&self; //[base]~ NOTE ...is used here...
|
2021-10-10 05:37:57 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|