Skip to content

Commit 9ea6d23

Browse files
michaelwoeristernikomatsakis
authored andcommitted
---
yaml --- r: 276477 b: refs/heads/try c: 7a5a988 h: refs/heads/master i: 276475: ef2d90a
1 parent 0ab4e2a commit 9ea6d23

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 6f60c9e1fd1a6d7349cede373ac1ffe6d0757b87
4+
refs/heads/try: 7a5a98857965830dc0c2f58d853f3abc813f7dd7
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_trans/back/symbol_names.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
//! virtually impossible. Thus, symbol hash generation exclusively relies on
9797
//! DefPaths which are much more robust in the face of changes to the code base.
9898
99-
use trans::{CrateContext, Instance};
99+
use trans::{CrateContext, Instance, gensym_name};
100100
use util::sha2::{Digest, Sha256};
101101

102102
use rustc::middle::cstore;
@@ -221,3 +221,15 @@ pub fn exported_name_with_suffix<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
221221
-> String {
222222
exported_name_with_opt_suffix(ccx, instance, Some(suffix))
223223
}
224+
225+
/// Only symbols that are invisible outside their compilation unit should use a
226+
/// name generated by this function.
227+
pub fn internal_name_from_type_and_suffix<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
228+
t: ty::Ty<'tcx>,
229+
suffix: &str)
230+
-> String {
231+
let path = [token::intern(&t.to_string()).as_str(),
232+
gensym_name(suffix).as_str()];
233+
let hash = get_symbol_hash(ccx, &Vec::new(), cstore::LOCAL_CRATE, &[t]);
234+
link::mangle(path.iter().cloned(), Some(&hash[..]))
235+
}

branches/try/src/librustc_trans/trans/glue.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use std;
1616

17-
use back::link;
17+
use back::symbol_names;
1818
use llvm;
1919
use llvm::{ValueRef, get_param};
2020
use middle::lang_items::ExchangeFreeFnLangItem;
@@ -259,7 +259,12 @@ fn get_drop_glue_core<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
259259
return llfn;
260260
};
261261

262-
let fn_nm = link::mangle_internal_name_by_type_and_seq(ccx, t, "drop");
262+
let suffix = match g {
263+
DropGlueKind::Ty(_) => "drop",
264+
DropGlueKind::TyContents(_) => "drop_contents",
265+
};
266+
267+
let fn_nm = symbol_names::internal_name_from_type_and_suffix(ccx, t, suffix);
263268
assert!(declare::get_defined_value(ccx, &fn_nm).is_none());
264269
let llfn = declare::declare_cfn(ccx, &fn_nm, llfnty);
265270
ccx.available_drop_glues().borrow_mut().insert(g, fn_nm);

0 commit comments

Comments
 (0)