Use Symbol
for dup check in #[rustc_must_implement_one_of]
This commit is contained in:
parent
f9174e1d80
commit
28edd7ac09
1 changed files with 3 additions and 8 deletions
|
@ -1306,18 +1306,13 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: DefId) -> ty::TraitDef {
|
||||||
})
|
})
|
||||||
// Check for duplicates
|
// Check for duplicates
|
||||||
.and_then(|list| {
|
.and_then(|list| {
|
||||||
let mut set: FxHashSet<&Ident> = FxHashSet::default();
|
let mut set: FxHashMap<Symbol, Span> = FxHashMap::default();
|
||||||
let mut no_dups = true;
|
let mut no_dups = true;
|
||||||
|
|
||||||
for ident in &*list {
|
for ident in &*list {
|
||||||
if let Some(dup) = set.replace(ident) {
|
if let Some(dup) = set.insert(ident.name, ident.span) {
|
||||||
let dup2 = set.get(&dup).copied().unwrap(); // We've just inserted it
|
|
||||||
|
|
||||||
tcx.sess
|
tcx.sess
|
||||||
.struct_span_err(
|
.struct_span_err(vec![dup, ident.span], "Functions names are duplicated")
|
||||||
vec![dup.span, dup2.span],
|
|
||||||
"Functions names are duplicated",
|
|
||||||
)
|
|
||||||
.note(
|
.note(
|
||||||
"All `#[rustc_must_implement_one_of]` arguments \
|
"All `#[rustc_must_implement_one_of]` arguments \
|
||||||
must be unique",
|
must be unique",
|
||||||
|
|
Loading…
Add table
Reference in a new issue