mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
15 lines
229 B
Rust
15 lines
229 B
Rust
fn main() {
|
|
let p;
|
|
{
|
|
let a = 42;
|
|
p = &a;
|
|
//~^ ERROR `a` does not live long enough
|
|
|
|
}
|
|
p.use_ref();
|
|
|
|
}
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
impl<T> Fake for T { }
|