11error[E0716]: temporary value dropped while borrowed
2- --> $DIR/format-args-temporary-scopes.rs:13 :25
2+ --> $DIR/format-args-temporary-scopes.rs:12 :25
33 |
44LL | println!("{:?}", { &temp() });
55 | ---^^^^^---
@@ -11,7 +11,7 @@ LL | println!("{:?}", { &temp() });
1111 = note: consider using a `let` binding to create a longer lived value
1212
1313error[E0716]: temporary value dropped while borrowed
14- --> $DIR/format-args-temporary-scopes.rs:19 :29
14+ --> $DIR/format-args-temporary-scopes.rs:18 :29
1515 |
1616LL | println!("{:?}{:?}", { &temp() }, ());
1717 | ---^^^^^---
@@ -22,6 +22,19 @@ LL | println!("{:?}{:?}", { &temp() }, ());
2222 |
2323 = note: consider using a `let` binding to create a longer lived value
2424
25- error: aborting due to 2 previous errors
25+ error[E0716]: temporary value dropped while borrowed
26+ --> $DIR/format-args-temporary-scopes.rs:25:41
27+ |
28+ LL | println!("{:?}{:?}", (), if true { &format!("") } else { "" });
29+ | -^^^^^^^^^^-
30+ | || |
31+ | || temporary value is freed at the end of this statement
32+ | |creates a temporary value which is freed while still in use
33+ | borrow later used here
34+ |
35+ = note: consider using a `let` binding to create a longer lived value
36+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
37+
38+ error: aborting due to 3 previous errors
2639
2740For more information about this error, try `rustc --explain E0716`.
0 commit comments