1
Fork 0

Report duplicate definitions in trait impls during resolution.

This commit is contained in:
Camille GILLOT 2022-08-10 21:31:26 +02:00
parent 8796e7a9cf
commit 152cd63226
11 changed files with 142 additions and 30 deletions

View file

@ -197,6 +197,9 @@ fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: Symbol
/// Enforce that we do not have two items in an impl with the same name.
fn enforce_impl_items_are_distinct(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) {
if tcx.impl_trait_ref(impl_def_id).is_some() {
return;
}
let mut seen_type_items = FxHashMap::default();
let mut seen_value_items = FxHashMap::default();
for &impl_item_ref in tcx.associated_item_def_ids(impl_def_id) {