rust/src/test/ui/issues/issue-11493.rs
2018-12-25 21:08:33 -07:00

15 lines
386 B
Rust

// This file must never have a trailing newline
//
// revisions: ast mir
// compile-flags: -Z borrowck=compare
fn id<T>(x: T) -> T { x }
fn main() {
let x = Some(3);
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
}