rust/src/test/ui/const-generics/fn-const-param-call.rs

20 lines
428 B
Rust
Raw Normal View History

#![feature(const_generics)]
2020-04-22 10:21:32 +02:00
//~^ WARN the feature `const_generics` is incomplete
fn function() -> u32 {
17
}
struct Wrapper<const F: fn() -> u32>; //~ ERROR: using function pointers as const generic parameters
impl<const F: fn() -> u32> Wrapper<F> {
//~^ ERROR: using function pointers as const generic parameters
fn call() -> u32 {
F()
}
}
fn main() {
assert_eq!(Wrapper::<function>::call(), 17);
}