@@ -26,7 +26,38 @@ LL | let _: &'static _ = &String::new();
2626LL | };
2727 | - temporary value is freed at the end of this statement
2828
29- error: aborting due to 3 previous errors
29+ error[E0716]: temporary value dropped while borrowed
30+ --> $DIR/promoted_const_call3.rs:7:26
31+ |
32+ LL | let _: &'static _ = &id(&String::new());
33+ | ---------- ^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
34+ | |
35+ | type annotation requires that borrow lasts for `'static`
36+ ...
37+ LL | };
38+ | - temporary value is freed at the end of this statement
39+
40+ error[E0716]: temporary value dropped while borrowed
41+ --> $DIR/promoted_const_call3.rs:7:30
42+ |
43+ LL | let _: &'static _ = &id(&String::new());
44+ | ---------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
45+ | | |
46+ | | creates a temporary value which is freed while still in use
47+ | type annotation requires that borrow lasts for `'static`
48+
49+ error[E0716]: temporary value dropped while borrowed
50+ --> $DIR/promoted_const_call3.rs:12:26
51+ |
52+ LL | let _: &'static _ = &std::mem::ManuallyDrop::new(String::new());
53+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
54+ | |
55+ | type annotation requires that borrow lasts for `'static`
56+ LL |
57+ LL | };
58+ | - temporary value is freed at the end of this statement
59+
60+ error: aborting due to 6 previous errors
3061
3162Some errors have detailed explanations: E0493, E0716.
3263For more information about an error, try `rustc --explain E0493`.
0 commit comments