summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/issues/issue-100313.rs
blob: 9af9b5ca45851c231947f2098ea7c01129628e54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#![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]
            //~| ERROR assigning to `&T` is undefined behavior
        }
    }
}

const _: () = {
    let x = T::<{&true}>;
    x.set_false();
};

fn main() {}