88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11+ // revisions: ast mir
12+ //[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
13+
1114use std:: cell:: RefCell ;
1215
1316fn main ( ) {
@@ -16,10 +19,20 @@ fn main() {
1619 let x = RefCell :: new ( ( & mut r, s) ) ;
1720
1821 let val: & _ = x. borrow ( ) . 0 ;
19- //~^ ERROR borrowed value does not live long enough
20- //~| temporary value dropped here while still borrowed
21- //~| temporary value created here
22- //~| consider using a `let` binding to increase its lifetime
22+ //[ast]~^ ERROR borrowed value does not live long enough [E0597]
23+ //[ast]~| NOTE temporary value dropped here while still borrowed
24+ //[ast]~| NOTE temporary value created here
25+ //[ast]~| NOTE consider using a `let` binding to increase its lifetime
26+ //[mir]~^^^^^ ERROR borrowed value does not live long enough (Ast) [E0597]
27+ //[mir]~| NOTE temporary value dropped here while still borrowed
28+ //[mir]~| NOTE temporary value created here
29+ //[mir]~| NOTE consider using a `let` binding to increase its lifetime
30+ //[mir]~| ERROR borrowed value does not live long enough (Mir) [E0597]
31+ //[mir]~| NOTE temporary value dropped here while still borrowed
32+ //[mir]~| NOTE temporary value created here
33+ //[mir]~| NOTE consider using a `let` binding to increase its lifetime
2334 println ! ( "{}" , val) ;
2435}
25- //~^ temporary value needs to live until here
36+ //[ast]~^ NOTE temporary value needs to live until here
37+ //[mir]~^^ NOTE temporary value needs to live until here
38+ //[mir]~| NOTE temporary value needs to live until here
0 commit comments