Skip to content

Commit a3dc048

Browse files
Use new symbol names for items of various kinds.
1 parent 9a1465c commit a3dc048

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/librustc_trans/trans/base.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ pub use self::ValueOrigin::*;
2929
use super::CrateTranslation;
3030
use super::ModuleTranslation;
3131

32-
use back::link::mangle_exported_name;
33-
use back::{link, abi};
32+
use back::{link, abi, symbol_names};
3433
use lint;
3534
use llvm::{BasicBlockRef, Linkage, ValueRef, Vector, get_param};
3635
use llvm;
@@ -2732,16 +2731,17 @@ fn exported_name<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
27322731
// Use provided name
27332732
Some(name) => name.to_string(),
27342733
_ => {
2735-
let path = ccx.tcx().map.def_path_from_id(id);
27362734
if attr::contains_name(attrs, "no_mangle") {
27372735
// Don't mangle
2736+
let path = ccx.tcx().map.def_path_from_id(id);
27382737
path.last().unwrap().data.to_string()
27392738
} else {
27402739
match weak_lang_items::link_name(attrs) {
27412740
Some(name) => name.to_string(),
27422741
None => {
27432742
// Usual name mangling
2744-
mangle_exported_name(ccx, path, ty, id)
2743+
let def_id = ccx.tcx().map.local_def_id(id);
2744+
symbol_names::exported_name(ccx, def_id, &[ty])
27452745
}
27462746
}
27472747
}
@@ -2764,7 +2764,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
27642764
debug!("get_item_val: id={} item={:?}", id, item);
27652765
let val = match item {
27662766
hir_map::NodeItem(i) => {
2767-
let ty = ccx.tcx().node_id_to_type(i.id);
2767+
let ty = ccx.tcx().erase_regions(&ccx.tcx().node_id_to_type(i.id));
27682768
let sym = || exported_name(ccx, id, ty, &i.attrs);
27692769

27702770
let v = match i.node {
@@ -2836,7 +2836,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
28362836
match ni.node {
28372837
hir::ForeignItemFn(..) => {
28382838
let abi = ccx.tcx().map.get_foreign_abi(id);
2839-
let ty = ccx.tcx().node_id_to_type(ni.id);
2839+
let ty = ccx.tcx().erase_regions(&ccx.tcx().node_id_to_type(ni.id));
28402840
let name = foreign::link_name(&ni);
28412841
foreign::register_foreign_item_fn(ccx, abi, ty, &name, &ni.attrs)
28422842
}
@@ -2854,7 +2854,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
28542854
v.node.data.fields()
28552855
};
28562856
assert!(!fields.is_empty());
2857-
let ty = ccx.tcx().node_id_to_type(id);
2857+
let ty = ccx.tcx().erase_regions(&ccx.tcx().node_id_to_type(id));
28582858
let parent = ccx.tcx().map.get_parent(id);
28592859
let enm = ccx.tcx().map.expect_item(parent);
28602860
let sym = exported_name(ccx, id, ty, &enm.attrs);
@@ -2878,7 +2878,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
28782878
};
28792879
let parent = ccx.tcx().map.get_parent(id);
28802880
let struct_item = ccx.tcx().map.expect_item(parent);
2881-
let ty = ccx.tcx().node_id_to_type(ctor_id);
2881+
let ty = ccx.tcx().erase_regions(&ccx.tcx().node_id_to_type(ctor_id));
28822882
let sym = exported_name(ccx, id, ty, &struct_item.attrs);
28832883
let llfn = register_fn(ccx, struct_item.span, sym, ctor_id, ty);
28842884
attributes::inline(llfn, attributes::InlineAttr::Hint);
@@ -2908,7 +2908,7 @@ fn register_method(ccx: &CrateContext,
29082908
attrs: &[ast::Attribute],
29092909
span: Span)
29102910
-> ValueRef {
2911-
let mty = ccx.tcx().node_id_to_type(id);
2911+
let mty = ccx.tcx().erase_regions(&ccx.tcx().node_id_to_type(id));
29122912

29132913
let sym = exported_name(ccx, id, mty, &attrs);
29142914

src/test/run-pass/backtrace.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn runtest(me: &str) {
5151
let out = p.wait_with_output().unwrap();
5252
assert!(!out.status.success());
5353
let s = str::from_utf8(&out.stderr).unwrap();
54-
assert!(s.contains("stack backtrace") && s.contains(" - foo"),
54+
assert!(s.contains("stack backtrace") && s.contains(" - backtrace::foo"),
5555
"bad output: {}", s);
5656

5757
// Make sure the stack trace is *not* printed
@@ -61,7 +61,7 @@ fn runtest(me: &str) {
6161
let out = p.wait_with_output().unwrap();
6262
assert!(!out.status.success());
6363
let s = str::from_utf8(&out.stderr).unwrap();
64-
assert!(!s.contains("stack backtrace") && !s.contains(" - foo"),
64+
assert!(!s.contains("stack backtrace") && !s.contains(" - backtrace::foo"),
6565
"bad output2: {}", s);
6666

6767
// Make sure a stack trace is printed
@@ -71,7 +71,7 @@ fn runtest(me: &str) {
7171
let s = str::from_utf8(&out.stderr).unwrap();
7272
// loosened the following from double::h to double:: due to
7373
// spurious failures on mac, 32bit, optimized
74-
assert!(s.contains("stack backtrace") && s.contains(" - double"),
74+
assert!(s.contains("stack backtrace") && s.contains(" - backtrace::double"),
7575
"bad output3: {}", s);
7676

7777
// Make sure a stack trace isn't printed too many times

src/test/run-pass/issue-17718.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// aux-build:issue-17718.rs
11+
// aux-build:issue-17718-aux.rs
1212

1313

1414
#![feature(core)]
1515
#![feature(const_fn)]
1616

17-
extern crate issue_17718 as other;
17+
extern crate issue_17718_aux as other;
1818

1919
use std::sync::atomic::{AtomicUsize, Ordering};
2020

0 commit comments

Comments
 (0)