@@ -2607,7 +2607,7 @@ pub struct ClashingExternDeclarations {
26072607 /// the symbol should be reported as a clashing declaration.
26082608 // FIXME: Technically, we could just store a &'tcx str here without issue; however, the
26092609 // `impl_lint_pass` macro doesn't currently support lints parametric over a lifetime.
2610- seen_decls : FxHashMap < String , HirId > ,
2610+ seen_decls : FxHashMap < Symbol , HirId > ,
26112611}
26122612
26132613/// Differentiate between whether the name for an extern decl came from the link_name attribute or
@@ -2641,14 +2641,14 @@ impl ClashingExternDeclarations {
26412641 let local_did = tcx. hir ( ) . local_def_id ( fi. hir_id ) ;
26422642 let did = local_did. to_def_id ( ) ;
26432643 let instance = Instance :: new ( did, ty:: List :: identity_for_item ( tcx, did) ) ;
2644- let name = tcx. symbol_name ( instance) . name ;
2645- if let Some ( & hir_id) = self . seen_decls . get ( name) {
2644+ let name = Symbol :: intern ( tcx. symbol_name ( instance) . name ) ;
2645+ if let Some ( & hir_id) = self . seen_decls . get ( & name) {
26462646 // Avoid updating the map with the new entry when we do find a collision. We want to
26472647 // make sure we're always pointing to the first definition as the previous declaration.
26482648 // This lets us avoid emitting "knock-on" diagnostics.
26492649 Some ( hir_id)
26502650 } else {
2651- self . seen_decls . insert ( name. to_owned ( ) , hid)
2651+ self . seen_decls . insert ( name, hid)
26522652 }
26532653 }
26542654
0 commit comments