Skip to content

Commit 0e021ad

Browse files
committed
switch extern_statics map to symbols
1 parent 7cdcdec commit 0e021ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/machine.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc::ty::{
1616
Ty,
1717
};
1818
use rustc_ast::attr;
19-
use rustc_span::{source_map::Span, symbol::sym};
19+
use rustc_span::{source_map::Span, symbol::{sym, Symbol}};
2020

2121
use crate::*;
2222

@@ -75,7 +75,7 @@ pub struct MemoryExtra {
7575
pub intptrcast: intptrcast::MemoryExtra,
7676

7777
/// Mapping extern static names to their canonical allocation.
78-
pub(crate) extern_statics: HashMap<&'static str, AllocId>,
78+
pub(crate) extern_statics: HashMap<Symbol, AllocId>,
7979

8080
/// The random number generator used for resolving non-determinism.
8181
/// Needs to be queried by ptr_to_int, hence needs interior mutability.
@@ -111,7 +111,7 @@ impl MemoryExtra {
111111
this.memory
112112
.extra
113113
.extern_statics
114-
.insert("__cxa_thread_atexit_impl", place.ptr.assert_ptr().alloc_id)
114+
.insert(Symbol::intern("__cxa_thread_atexit_impl"), place.ptr.assert_ptr().alloc_id)
115115
.unwrap_none();
116116
}
117117
_ => {} // No "extern statics" supported on this platform
@@ -310,11 +310,11 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
310310
};
311311
let attrs = tcx.get_attrs(def_id);
312312
let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) {
313-
Some(name) => name.as_str(),
314-
None => tcx.item_name(def_id).as_str(),
313+
Some(name) => name,
314+
None => tcx.item_name(def_id),
315315
};
316316
// Check if we know this one.
317-
if let Some(canonical_id) = mem.extra.extern_statics.get(&*link_name) {
317+
if let Some(canonical_id) = mem.extra.extern_statics.get(&link_name) {
318318
trace!("canonical_alloc_id: {:?} ({}) -> {:?}", id, link_name, canonical_id);
319319
*canonical_id
320320
} else {

0 commit comments

Comments
 (0)