about summary refs log tree commit diff
path: root/tests/ui/const-generics/transmute-const-param-static-reference.rs
blob: bf164bdadb0e0e99e0132b4e0531260bf85ad66b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//@ revisions: full adt_const_params min
//@[full] check-pass

#![cfg_attr(full, feature(adt_const_params, unsized_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(adt_const_params, feature(adt_const_params))]
#![cfg_attr(adt_const_params, allow(incomplete_features))]

struct Const<const P: &'static ()>;
//[min]~^ ERROR `&'static ()` is forbidden as the type of a const generic parameter
//[adt_const_params]~^^ ERROR use of unstable library feature `unsized_const_params`

fn main() {
    const A: &'static () = unsafe { std::mem::transmute(10 as *const ()) };

    let _ = Const::<{ A }>;
}