mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
17 lines
383 B
Rust
17 lines
383 B
Rust
#![feature(rustc_attrs)]
|
|
use std::ops::FnMut;
|
|
|
|
fn main() { #![rustc_error] // rust-lang/rust#49855
|
|
let mut f;
|
|
{
|
|
let c = 1;
|
|
let c_ref = &c;
|
|
//~^ ERROR `c` does not live long enough
|
|
f = move |a: isize, b: isize| { a + b + *c_ref };
|
|
}
|
|
f.use_mut();
|
|
}
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
impl<T> Fake for T { }
|