2020-08-26 05:22:55 -05:00
|
|
|
// revisions: full min
|
2021-08-30 03:59:53 -05:00
|
|
|
#![cfg_attr(full, feature(adt_const_params))]
|
2020-08-26 05:22:55 -05:00
|
|
|
#![cfg_attr(full, allow(incomplete_features))]
|
2020-06-27 06:33:50 -05:00
|
|
|
|
|
|
|
struct Test(*const usize);
|
|
|
|
|
|
|
|
type PassArg = ();
|
|
|
|
|
|
|
|
unsafe extern "C" fn pass(args: PassArg) {
|
|
|
|
println!("Hello, world!");
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Test {
|
|
|
|
pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
|
2023-05-16 23:05:46 -05:00
|
|
|
//[min]~^ ERROR: using function pointers as const generic parameters is forbidden
|
|
|
|
//~^^ ERROR: the type of const parameters must not depend on other generic parameters
|
2020-06-27 06:33:50 -05:00
|
|
|
self.0 = Self::trampiline::<Args, IDX, FN> as _
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn trampiline<
|
|
|
|
Args: Sized,
|
|
|
|
const IDX: usize,
|
|
|
|
const FN: unsafe extern "C" fn(Args),
|
2023-05-16 23:05:46 -05:00
|
|
|
//[min]~^ ERROR: using function pointers as const generic parameters is forbidden
|
|
|
|
//~^^ ERROR: the type of const parameters must not depend on other generic parameters
|
2020-06-27 06:33:50 -05:00
|
|
|
>(
|
|
|
|
args: Args,
|
|
|
|
) {
|
|
|
|
FN(args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-05-16 23:05:46 -05:00
|
|
|
let x = Test(std::ptr::null());
|
2020-06-27 06:33:50 -05:00
|
|
|
x.call_me::<PassArg, 30, pass>()
|
|
|
|
}
|