blob: 1f61356162ca6ca6d80036cbbcc6e39d4788af65 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 | //@ dont-require-annotations: NOTE
#![allow(incomplete_features)]
#![feature(adt_const_params, unsized_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; //~ NOTE inside `T
        }
    }
}
const _: () = {
    let x = T::<{ &true }>;
    x.set_false(); //~ ERROR writing to ALLOC0 which is read-only
};
fn main() {}
 |