2021-09-21 15:07:28 +02:00
|
|
|
#![feature(fn_traits)]
|
2024-07-14 13:38:51 +01:00
|
|
|
#![feature(adt_const_params, unsized_const_params)]
|
|
|
|
|
//~^ WARNING the feature `unsized_const_params` is incomplete
|
2021-09-21 15:07:28 +02:00
|
|
|
|
|
|
|
|
#[derive(PartialEq, Eq)]
|
2024-07-14 13:38:51 +01:00
|
|
|
struct CompileTimeSettings {
|
|
|
|
|
hooks: &'static [fn()],
|
2021-09-21 15:07:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Foo<const T: CompileTimeSettings>;
|
2023-05-17 04:05:46 +00:00
|
|
|
//~^ ERROR `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
2021-09-21 15:07:28 +02:00
|
|
|
|
|
|
|
|
impl<const T: CompileTimeSettings> Foo<T> {
|
2023-05-17 04:05:46 +00:00
|
|
|
//~^ ERROR `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
2024-07-14 13:38:51 +01:00
|
|
|
fn call_hooks() {}
|
2021-09-21 15:07:28 +02:00
|
|
|
}
|
|
|
|
|
|
2024-07-14 13:38:51 +01:00
|
|
|
fn main() {
|
|
|
|
|
const SETTINGS: CompileTimeSettings = CompileTimeSettings { hooks: &[] };
|
2021-09-21 15:07:28 +02:00
|
|
|
|
|
|
|
|
Foo::<SETTINGS>::call_hooks();
|
|
|
|
|
}
|