File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
src/test/ui/consts/const-eval Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ error[E0716]: temporary value dropped while borrowed
1414 |
1515LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough
1616 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
17- LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough
17+ ...
1818LL | }
1919 | - temporary value is freed at the end of this statement
2020 |
@@ -25,11 +25,22 @@ error[E0716]: temporary value dropped while borrowed
2525 |
2626LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough
2727 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
28+ LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough
29+ LL | }
30+ | - temporary value is freed at the end of this statement
31+ |
32+ = note: borrowed value must be valid for the static lifetime...
33+
34+ error[E0716]: temporary value dropped while borrowed
35+ --> $DIR/promoted_raw_ptr_ops.rs:18:29
36+ |
37+ LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough
38+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
2839LL | }
2940 | - temporary value is freed at the end of this statement
3041 |
3142 = note: borrowed value must be valid for the static lifetime...
3243
33- error: aborting due to 3 previous errors
44+ error: aborting due to 4 previous errors
3445
3546For more information about this error, try `rustc --explain E0716`.
Original file line number Diff line number Diff line change @@ -15,4 +15,5 @@ fn main() {
1515 //~^ ERROR does not live long enough
1616 let y: & ' static usize = & ( & 1 as * const i32 as usize + 1 ) ; //~ ERROR does not live long enough
1717 let z: & ' static i32 = & ( unsafe { * ( 42 as * const i32 ) } ) ; //~ ERROR does not live long enough
18+ let a: & ' static bool = & ( main as fn ( ) == main as fn ( ) ) ; //~ ERROR does not live long enough
1819}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ error[E0597]: borrowed value does not live long enough
1414 |
1515LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough
1616 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
17- LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough
17+ ...
1818LL | }
1919 | - temporary value only lives until here
2020 |
@@ -25,11 +25,22 @@ error[E0597]: borrowed value does not live long enough
2525 |
2626LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough
2727 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
28+ LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough
29+ LL | }
30+ | - temporary value only lives until here
31+ |
32+ = note: borrowed value must be valid for the static lifetime...
33+
34+ error[E0597]: borrowed value does not live long enough
35+ --> $DIR/promoted_raw_ptr_ops.rs:18:29
36+ |
37+ LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough
38+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
2839LL | }
2940 | - temporary value only lives until here
3041 |
3142 = note: borrowed value must be valid for the static lifetime...
3243
33- error: aborting due to 3 previous errors
44+ error: aborting due to 4 previous errors
3445
3546For more information about this error, try `rustc --explain E0597`.
You can’t perform that action at this time.
0 commit comments