Fix feature gate tests
This commit is contained in:
parent
1c30399cea
commit
7299e8fc4d
4 changed files with 24 additions and 23 deletions
|
|
@ -1,2 +1,6 @@
|
|||
struct Foo<const NAME: &'static str>; //~ ERROR `&'static str` is forbidden
|
||||
struct Bar(u8);
|
||||
|
||||
struct Foo<const N: Bar>;
|
||||
//~^ ERROR: `Bar` is forbidden as the type of a const generic parameter
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
error: `&'static str` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/feature-gate-adt_const_params.rs:1:24
|
||||
error: `Bar` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/feature-gate-adt_const_params.rs:3:21
|
||||
|
|
||||
LL | struct Foo<const NAME: &'static str>;
|
||||
| ^^^^^^^^^^^^
|
||||
LL | struct Foo<const N: Bar>;
|
||||
| ^^^
|
||||
|
|
||||
= note: the only supported types are integers, `bool`, and `char`
|
||||
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
||||
|
|
||||
LL + #![feature(adt_const_params)]
|
||||
|
|
||||
help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait
|
||||
|
|
||||
LL + #![feature(unsized_const_params)]
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#![feature(adt_const_params)]
|
||||
|
||||
struct Bar(u8);
|
||||
|
||||
struct Foo<const N: Bar>;
|
||||
//~^ ERROR: `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
||||
struct Foo<const N: [u8]>;
|
||||
//~^ ERROR: `[u8]` is forbidden as the type of a const generic parameter
|
||||
//~| HELP: add `#![feature(adt_const_params)]` to the crate
|
||||
//~| HELP: add `#![feature(unsized_const_params)]` to the crate
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
error[E0741]: `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
||||
--> $DIR/feature-gate-unsized-const-params.rs:5:21
|
||||
error: `[u8]` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/feature-gate-unsized-const-params.rs:1:21
|
||||
|
|
||||
LL | struct Foo<const N: Bar>;
|
||||
| ^^^
|
||||
LL | struct Foo<const N: [u8]>;
|
||||
| ^^^^
|
||||
|
|
||||
help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct
|
||||
= note: the only supported types are integers, `bool`, and `char`
|
||||
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
|
||||
|
|
||||
LL - struct Bar(u8);
|
||||
LL + #[derive(ConstParamTy, PartialEq, Eq)]
|
||||
LL + #![feature(adt_const_params)]
|
||||
|
|
||||
help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait
|
||||
|
|
||||
LL + #![feature(unsized_const_params)]
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0741`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue