add test for the `const_generics_defaults` feature gate

This commit is contained in:
Rémy Rakic 2020-12-31 02:03:15 +01:00
parent ea8fa36bb4
commit 64244b2201
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,7 @@
struct A<const N: usize = 3>;
//~^ ERROR default values for const generic parameters are unstable
fn foo<const N: u8 = 6>() {}
//~^ ERROR default values for const generic parameters are unstable
fn main() {}

View File

@ -0,0 +1,18 @@
error: default values for const generic parameters are unstable
--> $DIR/feature-gate-const_generics_defaults.rs:1:27
|
LL | struct A<const N: usize = 3>;
| ^
|
= help: add `#![feature(const_generics_defaults)]` to the crate attributes to enable
error: default values for const generic parameters are unstable
--> $DIR/feature-gate-const_generics_defaults.rs:4:22
|
LL | fn foo<const N: u8 = 6>() {}
| ^
|
= help: add `#![feature(const_generics_defaults)]` to the crate attributes to enable
error: aborting due to 2 previous errors