8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ // revisions: ast mir
12
+ //[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
13
+
11
14
use std:: cell:: RefCell ;
12
15
13
16
fn main ( ) {
@@ -16,10 +19,20 @@ fn main() {
16
19
let x = RefCell :: new ( ( & mut r, s) ) ;
17
20
18
21
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
23
34
println ! ( "{}" , val) ;
24
35
}
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