blob: 62391f098e5d101995eb1411e2de50ab49d63778 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#![feature(const_precise_live_drops)]
pub const fn id<T>(x: T) -> T { x }
pub const C: () = {
let _: &'static _ = &id(&String::new());
//~^ ERROR: temporary value dropped while borrowed
//~| ERROR: temporary value dropped while borrowed
};
fn main() {
let _: &'static _ = &id(&String::new());
//~^ ERROR: temporary value dropped while borrowed
//~| ERROR: temporary value dropped while borrowed
}
|