Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1305,17 +1305,20 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
{
if ty.is_structural_eq_shallow(self.tcx) {
diag.span_suggestion(
span,
"add `#[derive(ConstParamTy)]` to the struct",
span.shrink_to_lo(),
format!("add `#[derive(ConstParamTy)]` to the {}", def.descr()),
"#[derive(ConstParamTy)]\n",
Applicability::MachineApplicable,
);
} else {
// FIXME(adt_const_params): We should check there's not already an
// overlapping `Eq`/`PartialEq` impl.
diag.span_suggestion(
span,
"add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct",
span.shrink_to_lo(),
format!(
"add `#[derive(ConstParamTy, PartialEq, Eq)]` to the {}",
def.descr()
),
"#[derive(ConstParamTy, PartialEq, Eq)]\n",
Applicability::MachineApplicable,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ LL | struct D<const X: C>;
|
help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct
|
LL - struct C;
LL + #[derive(ConstParamTy, PartialEq, Eq)]
LL | struct C;
|

error: aborting due to 1 previous error
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/const-generics/issue-80471.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ error[E0741]: `Nat` must implement `ConstParamTy` to be used as the type of a co
LL | fn foo<const N: Nat>() {}
| ^^^
|
help: add `#[derive(ConstParamTy)]` to the struct
help: add `#[derive(ConstParamTy)]` to the enum
|
LL - enum Nat {
LL + #[derive(ConstParamTy)]
LL | enum Nat {
|

error: aborting due to 1 previous error
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/const-generics/issues/issue-97278.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ error[E0741]: `Bar` must implement `ConstParamTy` to be used as the type of a co
LL | fn test<const BAR: Bar>() {}
| ^^^
|
help: add `#[derive(ConstParamTy)]` to the struct
help: add `#[derive(ConstParamTy)]` to the enum
|
LL - enum Bar {
LL + #[derive(ConstParamTy)]
LL | enum Bar {
|

error: aborting due to 1 previous error
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/consts/refs_check_const_eq-issue-88384.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ LL | struct Foo<const T: CompileTimeSettings>;
|
help: add `#[derive(ConstParamTy)]` to the struct
|
LL - struct CompileTimeSettings {
LL + #[derive(ConstParamTy)]
LL | struct CompileTimeSettings {
|

error[E0741]: `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter
Expand All @@ -27,8 +27,8 @@ LL | impl<const T: CompileTimeSettings> Foo<T> {
|
help: add `#[derive(ConstParamTy)]` to the struct
|
LL - struct CompileTimeSettings {
LL + #[derive(ConstParamTy)]
LL | struct CompileTimeSettings {
|

error: aborting due to 2 previous errors; 1 warning emitted
Expand Down
Loading