diff options
Diffstat (limited to 'src/test/ui')
7 files changed, 45 insertions, 7 deletions
diff --git a/src/test/ui/const-generics/min_const_generics/default_function_param.rs b/src/test/ui/const-generics/min_const_generics/default_function_param.rs index d7918a73ab8..5b0a42a4556 100644 --- a/src/test/ui/const-generics/min_const_generics/default_function_param.rs +++ b/src/test/ui/const-generics/min_const_generics/default_function_param.rs @@ -1,4 +1,4 @@ fn foo<const SIZE: usize = 5>() {} - //~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=` +//~^ ERROR default values for const generic parameters are experimental fn main() {} diff --git a/src/test/ui/const-generics/min_const_generics/default_function_param.stderr b/src/test/ui/const-generics/min_const_generics/default_function_param.stderr index 8eb796d9bb7..31b5ad5123e 100644 --- a/src/test/ui/const-generics/min_const_generics/default_function_param.stderr +++ b/src/test/ui/const-generics/min_const_generics/default_function_param.stderr @@ -1,8 +1,12 @@ -error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=` +error[E0658]: default values for const generic parameters are experimental --> $DIR/default_function_param.rs:1:26 | LL | fn foo<const SIZE: usize = 5>() {} - | ^ expected one of 7 possible tokens + | ^^^ + | + = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information + = help: add `#![feature(const_generics_defaults)]` to the crate attributes to enable error: aborting due to previous error +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/const-generics/min_const_generics/default_trait_param.rs b/src/test/ui/const-generics/min_const_generics/default_trait_param.rs index c8003ad5d44..14bac473ed9 100644 --- a/src/test/ui/const-generics/min_const_generics/default_trait_param.rs +++ b/src/test/ui/const-generics/min_const_generics/default_trait_param.rs @@ -1,4 +1,4 @@ trait Foo<const KIND: bool = true> {} - //~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=` +//~^ ERROR default values for const generic parameters are experimental fn main() {} diff --git a/src/test/ui/const-generics/min_const_generics/default_trait_param.stderr b/src/test/ui/const-generics/min_const_generics/default_trait_param.stderr index 6d112ef1de0..5617b35ad01 100644 --- a/src/test/ui/const-generics/min_const_generics/default_trait_param.stderr +++ b/src/test/ui/const-generics/min_const_generics/default_trait_param.stderr @@ -1,8 +1,12 @@ -error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=` +error[E0658]: default values for const generic parameters are experimental --> $DIR/default_trait_param.rs:1:28 | LL | trait Foo<const KIND: bool = true> {} - | ^ expected one of 7 possible tokens + | ^^^^^^ + | + = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information + = help: add `#![feature(const_generics_defaults)]` to the crate attributes to enable error: aborting due to previous error +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs index 845c6111b59..a85e2a2f2c4 100644 --- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs +++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs @@ -7,7 +7,7 @@ struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(T, U); //[full]~^ ERROR constant values inside of type parameter defaults //[min]~^^ ERROR generic parameters may not be used in const operations -// FIXME(const_generics:defaults): We still don't know how to we deal with type defaults. +// FIXME(const_generics_defaults): We still don't know how to deal with type defaults. struct Bar<T = [u8; N], const N: usize>(T); //~^ ERROR constant values inside of type parameter defaults //~| ERROR type parameters with a default diff --git a/src/test/ui/feature-gates/feature-gate-const_generics_defaults.rs b/src/test/ui/feature-gates/feature-gate-const_generics_defaults.rs new file mode 100644 index 00000000000..5b5ccc88873 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-const_generics_defaults.rs @@ -0,0 +1,9 @@ +#[cfg(FALSE)] +struct A<const N: usize = 3>; +//~^ ERROR default values for const generic parameters are experimental + +#[cfg(FALSE)] +fn foo<const B: bool = false>() {} +//~^ ERROR default values for const generic parameters are experimental + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-const_generics_defaults.stderr b/src/test/ui/feature-gates/feature-gate-const_generics_defaults.stderr new file mode 100644 index 00000000000..e2b48d793fd --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-const_generics_defaults.stderr @@ -0,0 +1,21 @@ +error[E0658]: default values for const generic parameters are experimental + --> $DIR/feature-gate-const_generics_defaults.rs:2:25 + | +LL | struct A<const N: usize = 3>; + | ^^^ + | + = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information + = help: add `#![feature(const_generics_defaults)]` to the crate attributes to enable + +error[E0658]: default values for const generic parameters are experimental + --> $DIR/feature-gate-const_generics_defaults.rs:6:22 + | +LL | fn foo<const B: bool = false>() {} + | ^^^^^^^ + | + = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information + = help: add `#![feature(const_generics_defaults)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. |
