Skip to content

Commit 51355ad

Browse files
committed
Add a test for [NotParam; 0]: ConstParamTy (not holding)
1 parent 2c5e716 commit 51355ad

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![allow(incomplete_features)]
2+
#![feature(adt_const_params)]
3+
4+
#[derive(PartialEq, Eq)]
5+
struct NotParam;
6+
7+
fn check<T: std::marker::ConstParamTy>() {}
8+
9+
fn main() {
10+
check::<[NotParam; 0]>();
11+
//~^ error: `NotParam` can't be used as a const parameter type
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0277]: `NotParam` can't be used as a const parameter type
2+
--> $DIR/const_param_ty_bad_empty_array.rs:10:13
3+
|
4+
LL | check::<[NotParam; 0]>();
5+
| ^^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `NotParam`
6+
|
7+
= note: required for `[NotParam; 0]` to implement `ConstParamTy`
8+
note: required by a bound in `check`
9+
--> $DIR/const_param_ty_bad_empty_array.rs:7:13
10+
|
11+
LL | fn check<T: std::marker::ConstParamTy>() {}
12+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
13+
14+
error: aborting due to previous error
15+
16+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)