Skip to content

Commit 10a862d

Browse files
committed
rustc: middle: use cheaper Name in resolve::Export instead of String.
1 parent f027607 commit 10a862d

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/librustc/metadata/encoder.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,6 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
451451
mod_path: PathElems,
452452
exp: &middle::resolve::Export) {
453453
if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
454-
let original_name = token::get_ident(item.ident);
455-
456454
let path_differs = ecx.tcx.map.with_path(exp.def_id.node, |path| {
457455
let (mut a, mut b) = (path, mod_path.clone());
458456
loop {
@@ -474,16 +472,16 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
474472
// encoded metadata for static methods relative to Bar,
475473
// but not yet for Foo.
476474
//
477-
if path_differs || original_name.get() != exp.name {
475+
if path_differs || item.ident.name != exp.name {
478476
if !encode_reexported_static_base_methods(ecx, rbml_w, exp) {
479477
if encode_reexported_static_trait_methods(ecx, rbml_w, exp) {
480478
debug!("(encode reexported static methods) {} [trait]",
481-
original_name);
479+
item.ident.name);
482480
}
483481
}
484482
else {
485483
debug!("(encode reexported static methods) {} [base]",
486-
original_name);
484+
item.ident.name);
487485
}
488486
}
489487
}
@@ -534,7 +532,7 @@ fn encode_reexports(ecx: &EncodeContext,
534532
rbml_w.wr_str(def_to_string(exp.def_id).as_slice());
535533
rbml_w.end_tag();
536534
rbml_w.start_tag(tag_items_data_item_reexport_name);
537-
rbml_w.wr_str(exp.name.as_slice());
535+
rbml_w.wr_str(exp.name.as_str());
538536
rbml_w.end_tag();
539537
rbml_w.end_tag();
540538
encode_reexported_static_methods(ecx, rbml_w, path.clone(), exp);

src/librustc/middle/resolve.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ type BindingMap = HashMap<Name, BindingInfo>;
9898
pub type ExportMap = NodeMap<Vec<Export>>;
9999

100100
pub struct Export {
101-
pub name: String, // The name of the target.
101+
pub name: Name, // The name of the target.
102102
pub def_id: DefId, // The definition of the target.
103103
}
104104

@@ -3873,11 +3873,10 @@ impl<'a> Resolver<'a> {
38733873
ns: Namespace) {
38743874
match namebindings.def_for_namespace(ns) {
38753875
Some(d) => {
3876-
let name = token::get_name(name);
38773876
debug!("(computing exports) YES: export '{}' => {}",
38783877
name, d.def_id());
38793878
exports.push(Export {
3880-
name: name.get().to_string(),
3879+
name: name,
38813880
def_id: d.def_id()
38823881
});
38833882
}

0 commit comments

Comments
 (0)