Skip to content

Commit 6a7c15e

Browse files
committed
Bless output of test consts/promote_const_let.rs for Polonius
1 parent 9410104 commit 6a7c15e

File tree

1 file changed

+29
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)