2022-08-10 02:58:53 -05:00
|
|
|
#![allow(incomplete_features)]
|
|
|
|
#![feature(const_mut_refs)]
|
|
|
|
#![feature(adt_const_params)]
|
|
|
|
|
|
|
|
struct T<const B: &'static bool>;
|
|
|
|
|
|
|
|
impl <const B: &'static bool> T<B> {
|
|
|
|
const fn set_false(&self) {
|
|
|
|
unsafe {
|
|
|
|
*(B as *const bool as *mut bool) = false;
|
|
|
|
//~^ ERROR evaluation of constant value failed [E0080]
|
2023-05-14 11:51:52 -05:00
|
|
|
//~| ERROR casting `&T` to `&mut T` is undefined behavior
|
2022-08-10 02:58:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const _: () = {
|
|
|
|
let x = T::<{&true}>;
|
|
|
|
x.set_false();
|
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {}
|