Add a test for [NotParam; 0]: ConstParamTy (not holding)

This commit is contained in:
Maybe Waffle 2023-03-03 18:20:17 +00:00
parent 2c5e7160f3
commit 51355ad92b
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#![allow(incomplete_features)]
#![feature(adt_const_params)]
#[derive(PartialEq, Eq)]
struct NotParam;
fn check<T: std::marker::ConstParamTy>() {}
fn main() {
check::<[NotParam; 0]>();
//~^ error: `NotParam` can't be used as a const parameter type
}

View File

@ -0,0 +1,16 @@
error[E0277]: `NotParam` can't be used as a const parameter type
--> $DIR/const_param_ty_bad_empty_array.rs:10:13
|
LL | check::<[NotParam; 0]>();
| ^^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `NotParam`
|
= note: required for `[NotParam; 0]` to implement `ConstParamTy`
note: required by a bound in `check`
--> $DIR/const_param_ty_bad_empty_array.rs:7:13
|
LL | fn check<T: std::marker::ConstParamTy>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.