Use E0741 for structural match error
This commit is contained in:
parent
7f13a4a80a
commit
2dda8ad98a
@ -1884,7 +1884,7 @@ fn main() {
|
||||
|
||||
Const parameters cannot depend on type parameters.
|
||||
The following is therefore invalid:
|
||||
```compile_fail,E0740
|
||||
```compile_fail,E0741
|
||||
#![feature(const_generics)]
|
||||
|
||||
fn const_id<T, const N: T>() -> T { // error
|
||||
|
@ -1536,7 +1536,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
hir_ty.span,
|
||||
E0740,
|
||||
E0741,
|
||||
"the types of const generic parameters must derive `PartialEq` and `Eq`",
|
||||
).span_label(
|
||||
hir_ty.span,
|
||||
|
@ -4978,11 +4978,11 @@ fn bar(&self) {}
|
||||
[RFC 2091]: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
|
||||
"##,
|
||||
|
||||
E0740: r##"
|
||||
E0741: r##"
|
||||
Only `structural_match` types (that is, types that derive `PartialEq` and `Eq`)
|
||||
may be used as the types of const generic parameters.
|
||||
|
||||
```compile_fail,E0740
|
||||
```compile_fail,E0741
|
||||
#![feature(const_generics)]
|
||||
|
||||
struct A;
|
||||
|
@ -7,7 +7,7 @@ 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[E0740]: the types of const generic parameters must derive `PartialEq` and `Eq`
|
||||
error[E0741]: the types of const generic parameters must derive `PartialEq` and `Eq`
|
||||
--> $DIR/const-param-type-depends-on-type-param-ungated.rs:3:22
|
||||
|
|
||||
LL | struct B<T, const N: T>(PhantomData<[T; N]>);
|
||||
@ -15,5 +15,5 @@ LL | struct B<T, const N: T>(PhantomData<[T; N]>);
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0658, E0740.
|
||||
Some errors have detailed explanations: E0658, E0741.
|
||||
For more information about an error, try `rustc --explain E0658`.
|
||||
|
@ -6,7 +6,7 @@ LL | #![feature(const_generics)]
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0740]: the types of const generic parameters must derive `PartialEq` and `Eq`
|
||||
error[E0741]: the types of const generic parameters must derive `PartialEq` and `Eq`
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:9:34
|
||||
|
|
||||
LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
@ -14,4 +14,4 @@ LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0740`.
|
||||
For more information about this error, try `rustc --explain E0741`.
|
||||
|
@ -6,7 +6,7 @@ LL | #![feature(const_generics)]
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0740]: the types of const generic parameters must derive `PartialEq` and `Eq`
|
||||
error[E0741]: the types of const generic parameters must derive `PartialEq` and `Eq`
|
||||
--> $DIR/forbid-non-structural_match-types.rs:11:19
|
||||
|
|
||||
LL | struct D<const X: C>;
|
||||
@ -14,4 +14,4 @@ LL | struct D<const X: C>;
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0740`.
|
||||
For more information about this error, try `rustc --explain E0741`.
|
||||
|
Loading…
Reference in New Issue
Block a user