about summary refs log tree commit diff
path: root/src/librustc/metadata
diff options
context:
space:
mode:
authormitaa <mitaa.ceb@gmail.com>2015-08-12 20:22:25 +0200
committermitaa <mitaa.ceb@gmail.com>2015-08-12 20:22:25 +0200
commitf357d559ca0835ba2fcad11eb30a8ce821b6df58 (patch)
tree770b1b1c0f3c21e5a62622d4d390523949d66087 /src/librustc/metadata
parent1db1417736fa9d682fb0c3e36d37c123c2944a17 (diff)
Replace get_item_path[-1] with get_item_name
Diffstat (limited to 'src/librustc/metadata')
-rw-r--r--src/librustc/metadata/csearch.rs6
-rw-r--r--src/librustc/metadata/decoder.rs4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs
index efa17912a32..693d6881b7f 100644
--- a/src/librustc/metadata/csearch.rs
+++ b/src/librustc/metadata/csearch.rs
@@ -95,6 +95,12 @@ pub fn get_item_path(tcx: &ty::ctxt, def: ast::DefId) -> Vec<ast_map::PathElem>
     })
 }
 
+pub fn get_item_name(tcx: &ty::ctxt, def: ast::DefId) -> ast::Name {
+    let cstore = &tcx.sess.cstore;
+    let cdata = cstore.get_crate_data(def.krate);
+    decoder::get_item_name(&cstore.intr, &cdata, def.node)
+}
+
 pub enum FoundAst<'ast> {
     Found(&'ast ast::InlinedItem),
     FoundParent(ast::DefId, &'ast ast::InlinedItem),
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index df5f798217f..3aacc8d68af 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -770,6 +770,10 @@ pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> Vec<ast_map::PathElem> {
     item_path(lookup_item(id, cdata.data()))
 }
 
+pub fn get_item_name(intr: &IdentInterner, cdata: Cmd, id: ast::NodeId) -> ast::Name {
+    item_name(intr, lookup_item(id, cdata.data()))
+}
+
 pub type DecodeInlinedItem<'a> =
     Box<for<'tcx> FnMut(Cmd,
                         &ty::ctxt<'tcx>,