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,19 @@ 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:17:48
15+ |
16+ LL | println!("{:?}", { std::convert::identity(&temp()) });
17+ | --------------------------^^^^^^---
18+ | | | |
19+ | | | temporary value is freed at the end of this statement
20+ | | creates a temporary value which is freed while still in use
21+ | borrow later used here
22+ |
23+ = note: consider using a `let` binding to create a longer lived value
24+
25+ error[E0716]: temporary value dropped while borrowed
26+ --> $DIR/format-args-temporary-scopes.rs:23:29
1527 |
1628LL | println!("{:?}{:?}", { &temp() }, ());
1729 | ---^^^^^---
@@ -22,6 +34,56 @@ LL | println!("{:?}{:?}", { &temp() }, ());
2234 |
2335 = note: consider using a `let` binding to create a longer lived value
2436
25- error: aborting due to 2 previous errors
37+ error[E0716]: temporary value dropped while borrowed
38+ --> $DIR/format-args-temporary-scopes.rs:26:52
39+ |
40+ LL | println!("{:?}{:?}", { std::convert::identity(&temp()) }, ());
41+ | --------------------------^^^^^^---
42+ | | | |
43+ | | | temporary value is freed at the end of this statement
44+ | | creates a temporary value which is freed while still in use
45+ | borrow later used here
46+ |
47+ = note: consider using a `let` binding to create a longer lived value
48+
49+ error[E0716]: temporary value dropped while borrowed
50+ --> $DIR/format-args-temporary-scopes.rs:40:90
51+ |
52+ LL | println!("{:?}{:?}", (), match true { true => &"" as &dyn std::fmt::Debug, false => &temp() });
53+ | ------------------------------------------------------------^^^^^---
54+ | | | |
55+ | | | temporary value is freed at the end of this statement
56+ | | creates a temporary value which is freed while still in use
57+ | borrow later used here
58+ |
59+ = note: consider using a `let` binding to create a longer lived value
60+
61+ error[E0716]: temporary value dropped while borrowed
62+ --> $DIR/format-args-temporary-scopes.rs:33:41
63+ |
64+ LL | println!("{:?}{:?}", (), if true { &format!("") } else { "" });
65+ | -^^^^^^^^^^-
66+ | || |
67+ | || temporary value is freed at the end of this statement
68+ | |creates a temporary value which is freed while still in use
69+ | borrow later used here
70+ |
71+ = note: consider using a `let` binding to create a longer lived value
72+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
73+
74+ error[E0716]: temporary value dropped while borrowed
75+ --> $DIR/format-args-temporary-scopes.rs:36:64
76+ |
77+ LL | println!("{:?}{:?}", (), if true { std::convert::identity(&format!("")) } else { "" });
78+ | ------------------------^^^^^^^^^^^-
79+ | | | |
80+ | | | temporary value is freed at the end of this statement
81+ | | creates a temporary value which is freed while still in use
82+ | borrow later used here
83+ |
84+ = note: consider using a `let` binding to create a longer lived value
85+ = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
86+
87+ error: aborting due to 7 previous errors
2688
2789For more information about this error, try `rustc --explain E0716`.
0 commit comments