Closed
Description
For example, the constant C is presumed not to need drop (the example can be easily adapted to other qualifs & situations):
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
#![feature(const_swap)]
pub const C: Option<String> = {
let mut x = None;
let mut y = Some(String::new());
let a = &mut x;
let b = &mut y;
std::mem::swap(a, b);
std::mem::forget(y);
x
};
pub const D: () = {
C;
};
@rustbot label +A-const-eval +A-const-fn +F-const_mut_refs