Skip to content

Commit

Permalink
Use E0741 for structural match error
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Oct 22, 2019
1 parent 7f13a4a commit 2dda8ad
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/librustc_resolve/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ E0671: r##"
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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4978,11 +4978,11 @@ the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
[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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ 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]>);
| ^ `T` doesn't derive both `PartialEq` and `Eq`

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`.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ 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]);
| ^ `T` doesn't derive both `PartialEq` and `Eq`

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`.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ 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>;
| ^ `C` doesn't derive both `PartialEq` and `Eq`

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`.

0 comments on commit 2dda8ad

Please sign in to comment.