mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
22 lines
429 B
Rust
22 lines
429 B
Rust
#![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]
|
|
}
|
|
}
|
|
}
|
|
|
|
const _: () = {
|
|
let x = T::<{&true}>;
|
|
x.set_false();
|
|
};
|
|
|
|
fn main() {}
|