2022-11-30 12:29:01 +00:00
|
|
|
#![feature(const_precise_live_drops)]
|
|
|
|
pub const fn id<T>(x: T) -> T { x }
|
|
|
|
pub const C: () = {
|
|
|
|
let _: &'static _ = &id(&String::new());
|
2022-11-30 14:35:23 +00:00
|
|
|
//~^ ERROR: temporary value dropped while borrowed
|
|
|
|
//~| ERROR: temporary value dropped while borrowed
|
|
|
|
//~| ERROR: destructor of `String` cannot be evaluated at compile-time
|
2022-11-30 12:29:01 +00:00
|
|
|
};
|
|
|
|
|
2022-12-01 13:22:29 +00:00
|
|
|
fn main() {
|
|
|
|
let _: &'static _ = &id(&String::new());
|
|
|
|
//~^ ERROR: temporary value dropped while borrowed
|
|
|
|
//~| ERROR: temporary value dropped while borrowed
|
|
|
|
}
|