]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/promoted_const_call2.rs
Rollup merge of #106927 - Ezrashaw:e0606-make-machine-applicable, r=estebank
[rust.git] / tests / ui / consts / promoted_const_call2.rs
1 #![feature(const_precise_live_drops)]
2 pub const fn id<T>(x: T) -> T { x }
3 pub const C: () = {
4     let _: &'static _ = &id(&String::new());
5     //~^ ERROR: temporary value dropped while borrowed
6     //~| ERROR: temporary value dropped while borrowed
7     //~| ERROR: destructor of `String` cannot be evaluated at compile-time
8 };
9
10 fn main() {
11     let _: &'static _ = &id(&String::new());
12     //~^ ERROR: temporary value dropped while borrowed
13     //~| ERROR: temporary value dropped while borrowed
14 }