mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
22 lines
417 B
Rust
22 lines
417 B
Rust
//@ edition:2018
|
|
fn require_static<T: 'static>(val: T) -> T {
|
|
val
|
|
}
|
|
|
|
struct Problem;
|
|
|
|
impl Problem {
|
|
pub async fn start(&self) {
|
|
//~^ NOTE let's call
|
|
//~| NOTE `self` is a reference
|
|
require_static(async move {
|
|
//~^ ERROR borrowed data escapes
|
|
//~| NOTE `self` escapes
|
|
//~| NOTE argument requires
|
|
&self;
|
|
});
|
|
}
|
|
}
|
|
|
|
fn main() {}
|