Skip to content

Commit 7299e8f

Browse files
committed
Fix feature gate tests
1 parent 1c30399 commit 7299e8f

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
struct Foo<const NAME: &'static str>; //~ ERROR `&'static str` is forbidden
1+
struct Bar(u8);
2+
3+
struct Foo<const N: Bar>;
4+
//~^ ERROR: `Bar` is forbidden as the type of a const generic parameter
5+
26
fn main() {}
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
error: `&'static str` is forbidden as the type of a const generic parameter
2-
--> $DIR/feature-gate-adt_const_params.rs:1:24
1+
error: `Bar` is forbidden as the type of a const generic parameter
2+
--> $DIR/feature-gate-adt_const_params.rs:3:21
33
|
4-
LL | struct Foo<const NAME: &'static str>;
5-
| ^^^^^^^^^^^^
4+
LL | struct Foo<const N: Bar>;
5+
| ^^^
66
|
77
= note: the only supported types are integers, `bool`, and `char`
88
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
99
|
1010
LL + #![feature(adt_const_params)]
1111
|
12-
help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait
13-
|
14-
LL + #![feature(unsized_const_params)]
15-
|
1612

1713
error: aborting due to 1 previous error
1814

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#![feature(adt_const_params)]
2-
3-
struct Bar(u8);
4-
5-
struct Foo<const N: Bar>;
6-
//~^ ERROR: `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter
1+
struct Foo<const N: [u8]>;
2+
//~^ ERROR: `[u8]` is forbidden as the type of a const generic parameter
3+
//~| HELP: add `#![feature(adt_const_params)]` to the crate
4+
//~| HELP: add `#![feature(unsized_const_params)]` to the crate
75

86
fn main() {}

tests/ui/feature-gates/feature-gate-unsized-const-params.stderr

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
error[E0741]: `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter
2-
--> $DIR/feature-gate-unsized-const-params.rs:5:21
1+
error: `[u8]` is forbidden as the type of a const generic parameter
2+
--> $DIR/feature-gate-unsized-const-params.rs:1:21
33
|
4-
LL | struct Foo<const N: Bar>;
5-
| ^^^
4+
LL | struct Foo<const N: [u8]>;
5+
| ^^^^
66
|
7-
help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct
7+
= note: the only supported types are integers, `bool`, and `char`
8+
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
89
|
9-
LL - struct Bar(u8);
10-
LL + #[derive(ConstParamTy, PartialEq, Eq)]
10+
LL + #![feature(adt_const_params)]
11+
|
12+
help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait
13+
|
14+
LL + #![feature(unsized_const_params)]
1115
|
1216

1317
error: aborting due to 1 previous error
1418

15-
For more information about this error, try `rustc --explain E0741`.

0 commit comments

Comments
 (0)