2023-07-27 15:51:02 +00:00
|
|
|
//@ known-bug: #103507
|
|
|
|
|
2022-11-30 12:29:01 +00:00
|
|
|
#![feature(const_mut_refs)]
|
|
|
|
#![feature(const_trait_impl)]
|
2023-04-16 11:12:37 +00:00
|
|
|
|
2022-11-30 12:29:01 +00:00
|
|
|
struct Panic;
|
|
|
|
impl const Drop for Panic { fn drop(&mut self) { panic!(); } }
|
2023-04-16 11:12:37 +00:00
|
|
|
|
2022-11-30 12:29:01 +00:00
|
|
|
pub const fn id<T>(x: T) -> T { x }
|
|
|
|
pub const C: () = {
|
|
|
|
let _: &'static _ = &id(&Panic);
|
2023-07-27 15:51:02 +00:00
|
|
|
//FIXME ~^ ERROR: temporary value dropped while borrowed
|
|
|
|
//FIXME ~| ERROR: temporary value dropped while borrowed
|
2022-11-30 12:29:01 +00:00
|
|
|
};
|
|
|
|
|
2022-12-01 13:22:29 +00:00
|
|
|
fn main() {
|
|
|
|
let _: &'static _ = &id(&Panic);
|
2023-07-27 15:51:02 +00:00
|
|
|
//FIXME ~^ ERROR: temporary value dropped while borrowed
|
|
|
|
//FIXME ~| ERROR: temporary value dropped while borrowed
|
2022-12-01 13:41:59 +00:00
|
|
|
let _: &'static _ = &&(Panic, 0).1;
|
2023-07-27 15:51:02 +00:00
|
|
|
//FIXME~^ ERROR: temporary value dropped while borrowed
|
|
|
|
//FIXME~| ERROR: temporary value dropped while borrowed
|
2022-12-01 13:22:29 +00:00
|
|
|
}
|