os-rust/src/test/ui/const-generics/raw-ptr-const-param-deref.rs

19 lines
429 B
Rust
Raw Normal View History

#![feature(const_generics)]
2020-04-22 10:21:32 +02:00
//~^ WARN the feature `const_generics` is incomplete
const A: u32 = 3;
struct Const<const P: *const u32>; //~ ERROR: using raw pointers as const generic parameters
impl<const P: *const u32> Const<P> { //~ ERROR: using raw pointers as const generic parameters
fn get() -> u32 {
unsafe {
*P
}
}
}
fn main() {
assert_eq!(Const::<{&A as *const _}>::get(), 3)
}