diff options
Diffstat (limited to 'tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs')
-rw-r--r-- | tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs new file mode 100644 index 00000000000..e4dc76703a2 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs @@ -0,0 +1,13 @@ +#![allow(incomplete_features)] +#![feature(adt_const_params)] + +#[derive(PartialEq, Eq)] +struct NotParam; + +fn check<T: std::marker::ConstParamTy + ?Sized>() {} + +fn main() { + check::<&NotParam>(); //~ error: `NotParam` can't be used as a const parameter type + check::<[NotParam]>(); //~ error: `NotParam` can't be used as a const parameter type + check::<[NotParam; 17]>(); //~ error: `NotParam` can't be used as a const parameter type +} |