Make sure const params with type params don't cause errors without a feature gate
This commit is contained in:
parent
976b3d1d9e
commit
102f7a8b26
2 changed files with 25 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
struct B<T, const N: T>(PhantomData<[T; N]>); //~ ERROR const generics are unstable
|
||||
//~^ ERROR const parameters cannot depend on type parameters
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
error[E0671]: const parameters cannot depend on type parameters
|
||||
--> $DIR/const-param-type-depends-on-type-param-ungated.rs:3:22
|
||||
|
|
||||
LL | struct B<T, const N: T>(PhantomData<[T; N]>);
|
||||
| ^ const parameter depends on type parameter
|
||||
|
||||
error[E0658]: const generics are unstable
|
||||
--> $DIR/const-param-type-depends-on-type-param-ungated.rs:3:19
|
||||
|
|
||||
LL | struct B<T, const N: T>(PhantomData<[T; N]>);
|
||||
| ^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/44580
|
||||
= help: add #![feature(const_generics)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0658, E0671.
|
||||
For more information about an error, try `rustc --explain E0658`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue