Skip to content

Commit 5f83096

Browse files
committed
Correections due to refactoring .
1 parent a823a7d commit 5f83096

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/librustc_metadata/decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ pub fn maybe_get_item_ast<'tcx>(cdata: Cmd, tcx: &TyCtxt<'tcx>, id: DefIndex)
810810
let mut parent_path = item_path(item_doc);
811811
parent_path.pop();
812812
let mut parent_def_path = def_path(cdata, id);
813-
parent_def_path.pop();
813+
parent_def_path.data.pop();
814814
if let Some(ast_doc) = reader::maybe_get_doc(item_doc, tag_ast as usize) {
815815
let ii = decode_inlined_item(cdata,
816816
tcx,
@@ -830,7 +830,7 @@ pub fn maybe_get_item_ast<'tcx>(cdata: Cmd, tcx: &TyCtxt<'tcx>, id: DefIndex)
830830
let mut grandparent_path = parent_path;
831831
grandparent_path.pop();
832832
let mut grandparent_def_path = parent_def_path;
833-
grandparent_def_path.pop();
833+
grandparent_def_path.data.pop();
834834
let parent_doc = cdata.lookup_item(parent_did.index);
835835
if let Some(ast_doc) = reader::maybe_get_doc(parent_doc, tag_ast as usize) {
836836
let ii = decode_inlined_item(cdata,

src/librustc_trans/trans/link_guard.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ pub fn get_or_insert_link_guard<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>)
4949
}
5050

5151
let llfty = Type::func(&[], &Type::void(ccx));
52-
let guard_function = declare::define_cfn(ccx,
53-
&guard_name[..],
54-
llfty,
55-
ccx.tcx().mk_nil()).unwrap_or_else(|| {
56-
ccx.sess().bug("Link guard already defined.");
57-
});
52+
if declare::get_defined_value(ccx, &guard_name[..]).is_some() {
53+
ccx.sess().bug(
54+
&format!("Link guard already defined"));
55+
}
56+
let guard_function = declare::declare_cfn(ccx, &guard_name[..], llfty);
5857

5958
attributes::emit_uwtable(guard_function, true);
6059
attributes::unwind(guard_function, false);
@@ -76,10 +75,12 @@ pub fn get_or_insert_link_guard<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>)
7675

7776
let dependency_guard_name = link_guard_name(&crate_name[..], &svh);
7877

79-
let decl = declare::declare_cfn(ccx,
80-
&dependency_guard_name[..],
81-
llfty,
82-
ccx.tcx().mk_nil());
78+
if declare::get_defined_value(ccx, &dependency_guard_name[..]).is_some() {
79+
ccx.sess().bug(
80+
&format!("Link guard already defined for dependency `{}`",
81+
crate_name));
82+
}
83+
let decl = declare::declare_cfn(ccx, &dependency_guard_name[..], llfty);
8384
attributes::unwind(decl, false);
8485

8586
llvm::LLVMPositionBuilderAtEnd(bld, llbb);

src/librustc_trans/trans/symbol_names_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use rustc_front::intravisit::{self, Visitor};
2121
use syntax::ast;
2222
use syntax::attr::AttrMetaMethods;
2323
use trans::common::CrateContext;
24+
use trans::monomorphize::Instance;
2425

2526
const SYMBOL_NAME: &'static str = "rustc_symbol_name";
2627
const ITEM_PATH: &'static str = "rustc_item_path";
@@ -50,8 +51,9 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> {
5051
let def_id = self.tcx.map.local_def_id(node_id);
5152
for attr in self.tcx.get_attrs(def_id).iter() {
5253
if attr.check_name(SYMBOL_NAME) {
53-
// for now, just monomorphic names
54-
let name = symbol_names::exported_name(self.ccx, def_id, &[]);
54+
// for now, can only use on monomorphic names
55+
let instance = Instance::mono(self.tcx, def_id);
56+
let name = symbol_names::exported_name(self.ccx, &instance);
5557
self.tcx.sess.span_err(attr.span, &format!("symbol-name({})", name));
5658
} else if attr.check_name(ITEM_PATH) {
5759
let path = self.tcx.item_path_str(def_id);

0 commit comments

Comments
 (0)