Avoid duplicated note
This commit is contained in:
parent
05c39438e2
commit
91425d0ef8
2 changed files with 8 additions and 7 deletions
|
@ -381,10 +381,10 @@ fn extend_type_not_partial_eq<'tcx>(
|
||||||
adts_without_partialeq: FxHashSet<Span>,
|
adts_without_partialeq: FxHashSet<Span>,
|
||||||
/// The user has written `impl PartialEq for Ty` which means it's non-structual,
|
/// The user has written `impl PartialEq for Ty` which means it's non-structual,
|
||||||
/// but we don't have a span to point at, so we'll just add them as a `note`.
|
/// but we don't have a span to point at, so we'll just add them as a `note`.
|
||||||
manual: Vec<Ty<'tcx>>,
|
manual: FxHashSet<Ty<'tcx>>,
|
||||||
/// The type has no `PartialEq` implementation, neither manual or derived, but
|
/// The type has no `PartialEq` implementation, neither manual or derived, but
|
||||||
/// we don't have a span to point at, so we'll just add them as a `note`.
|
/// we don't have a span to point at, so we'll just add them as a `note`.
|
||||||
without: Vec<Ty<'tcx>>,
|
without: FxHashSet<Ty<'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for UsedParamsNeedInstantiationVisitor<'tcx> {
|
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for UsedParamsNeedInstantiationVisitor<'tcx> {
|
||||||
|
@ -408,10 +408,10 @@ fn extend_type_not_partial_eq<'tcx>(
|
||||||
self.adts_without_partialeq.insert(ty_def_span);
|
self.adts_without_partialeq.insert(ty_def_span);
|
||||||
}
|
}
|
||||||
(true, false, _, _) => {
|
(true, false, _, _) => {
|
||||||
self.manual.push(ty);
|
self.manual.insert(ty);
|
||||||
}
|
}
|
||||||
(false, _, _, _) => {
|
(false, _, _, _) => {
|
||||||
self.without.push(ty);
|
self.without.insert(ty);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
@ -424,8 +424,8 @@ fn extend_type_not_partial_eq<'tcx>(
|
||||||
typing_env,
|
typing_env,
|
||||||
adts_with_manual_partialeq: FxHashSet::default(),
|
adts_with_manual_partialeq: FxHashSet::default(),
|
||||||
adts_without_partialeq: FxHashSet::default(),
|
adts_without_partialeq: FxHashSet::default(),
|
||||||
manual: vec![],
|
manual: FxHashSet::default(),
|
||||||
without: vec![],
|
without: FxHashSet::default(),
|
||||||
};
|
};
|
||||||
v.visit_ty(ty);
|
v.visit_ty(ty);
|
||||||
#[allow(rustc::potential_query_instability)] // Span labels will be sorted by the rendering
|
#[allow(rustc::potential_query_instability)] // Span labels will be sorted by the rendering
|
||||||
|
@ -439,11 +439,13 @@ fn extend_type_not_partial_eq<'tcx>(
|
||||||
"must be annotated with `#[derive(PartialEq)]` to be usable in patterns",
|
"must be annotated with `#[derive(PartialEq)]` to be usable in patterns",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#[allow(rustc::potential_query_instability)] // Span labels will be sorted by the rendering
|
||||||
for ty in v.manual {
|
for ty in v.manual {
|
||||||
err.note(format!(
|
err.note(format!(
|
||||||
"`{ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details"
|
"`{ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
#[allow(rustc::potential_query_instability)] // Span labels will be sorted by the rendering
|
||||||
for ty in v.without {
|
for ty in v.without {
|
||||||
err.note(format!(
|
err.note(format!(
|
||||||
"`{ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns"
|
"`{ty}` must be annotated with `#[derive(PartialEq)]` to be usable in patterns"
|
||||||
|
|
|
@ -9,7 +9,6 @@ LL | C => (),
|
||||||
|
|
|
|
||||||
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
|
||||||
= note: `std::alloc::Global` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
|
= note: `std::alloc::Global` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
|
||||||
= note: `std::alloc::Global` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
|
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue