@@ -2607,7 +2607,7 @@ pub struct ClashingExternDeclarations {
2607
2607
/// the symbol should be reported as a clashing declaration.
2608
2608
// FIXME: Technically, we could just store a &'tcx str here without issue; however, the
2609
2609
// `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 > ,
2611
2611
}
2612
2612
2613
2613
/// Differentiate between whether the name for an extern decl came from the link_name attribute or
@@ -2641,14 +2641,14 @@ impl ClashingExternDeclarations {
2641
2641
let local_did = tcx. hir ( ) . local_def_id ( fi. hir_id ) ;
2642
2642
let did = local_did. to_def_id ( ) ;
2643
2643
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) {
2646
2646
// Avoid updating the map with the new entry when we do find a collision. We want to
2647
2647
// make sure we're always pointing to the first definition as the previous declaration.
2648
2648
// This lets us avoid emitting "knock-on" diagnostics.
2649
2649
Some ( hir_id)
2650
2650
} else {
2651
- self . seen_decls . insert ( name. to_owned ( ) , hid)
2651
+ self . seen_decls . insert ( name, hid)
2652
2652
}
2653
2653
}
2654
2654
0 commit comments