fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.0 KiB30 linesraw
1error[E0597]: `y` does not live long enough
2  --> $DIR/promote_const_let.rs:4:9
3   |
4LL |     let x: &'static u32 = {
5   |            ------------ type annotation requires that `y` is borrowed for `'static`
6LL |         let y = 42;
7   |             - binding `y` declared here
8LL |         &y
9   |         ^^ borrowed value does not live long enough
10LL |     };
11   |     - `y` dropped here while still borrowed
12
13error[E0716]: temporary value dropped while borrowed
14  --> $DIR/promote_const_let.rs:6:28
15   |
16LL |       let x: &'static u32 = &{
17   |  ____________------------____^
18   | |            |
19   | |            type annotation requires that borrow lasts for `'static`
20LL | |         let y = 42;
21LL | |         y
22LL | |     };
23   | |_____^ creates a temporary value which is freed while still in use
24LL |   }
25   |   - temporary value is freed at the end of this statement
26
27error: aborting due to 2 previous errors
28
29Some errors have detailed explanations: E0597, E0716.
30For more information about an error, try `rustc --explain E0597`.