2020-06-12 19:25:14 +02:00
|
|
|
#![feature(const_generics)]
|
2020-04-22 10:21:32 +02:00
|
|
|
//~^ WARN the feature `const_generics` is incomplete
|
2019-10-01 17:55:26 +13:00
|
|
|
|
|
|
|
fn function() -> u32 {
|
|
|
|
17
|
|
|
|
}
|
|
|
|
|
2020-06-12 19:25:14 +02:00
|
|
|
struct Wrapper<const F: fn() -> u32>; //~ ERROR: using function pointers as const generic parameters
|
2019-10-01 17:55:26 +13:00
|
|
|
|
2019-11-18 14:57:23 -05:00
|
|
|
impl<const F: fn() -> u32> Wrapper<F> {
|
2020-06-12 19:25:14 +02:00
|
|
|
//~^ ERROR: using function pointers as const generic parameters
|
2019-10-01 17:55:26 +13:00
|
|
|
fn call() -> u32 {
|
|
|
|
F()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2019-11-18 14:57:23 -05:00
|
|
|
assert_eq!(Wrapper::<function>::call(), 17);
|
2019-10-02 20:29:16 +13:00
|
|
|
}
|