rust/src/test/ui/issues/issue-11493.rs

15 lines
386 B
Rust
Raw Normal View History

2014-05-07 05:53:02 +00:00
// This file must never have a trailing newline
2018-07-15 21:11:54 +00:00
//
// revisions: ast mir
// compile-flags: -Z borrowck=compare
2014-05-07 05:53:02 +00:00
2017-08-13 08:46:49 +00:00
fn id<T>(x: T) -> T { x }
2014-05-07 05:53:02 +00:00
fn main() {
2015-01-31 16:23:42 +00:00
let x = Some(3);
2018-07-15 21:11:54 +00:00
let y = x.as_ref().unwrap_or(&id(5));
//[ast]~^ ERROR borrowed value does not live long enough (Ast)
//[mir]~^^ ERROR borrowed value does not live long enough (Ast)
// This actually passes in mir
}