Skip to content

Commit 2a0e659

Browse files
committed
add a test for #80471
1 parent 5b8cf49 commit 2a0e659

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(adt_const_params)]
2+
//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
3+
4+
#[derive(PartialEq, Eq)]
5+
enum Nat {
6+
Z,
7+
S(Box<Nat>),
8+
}
9+
10+
fn foo<const N: Nat>() {}
11+
//~^ ERROR `Box<Nat>` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-80471.rs:1:12
3+
|
4+
LL | #![feature(adt_const_params)]
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
9+
10+
error[E0741]: `Box<Nat>` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
11+
--> $DIR/issue-80471.rs:10:17
12+
|
13+
LL | fn foo<const N: Nat>() {}
14+
| ^^^
15+
16+
error: aborting due to previous error; 1 warning emitted
17+
18+
For more information about this error, try `rustc --explain E0741`.

0 commit comments

Comments
 (0)