Skip to content

Commit 0206e6b

Browse files
committed
---
yaml --- r: 15337 b: refs/heads/try c: c83d61d h: refs/heads/master i: 15335: b30a524 v: v3
1 parent 244fdf4 commit 0206e6b

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: fc7fc90adfc9576507e730ab54f35d1073ab2a4f
5+
refs/heads/try: c83d61de936f2910001fe72de01ac58479d90524
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/back/link.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,14 @@ fn mangle(ss: path) -> str {
485485
n
486486
}
487487

488-
fn exported_name(path: path, hash: str, _vers: str) -> str {
488+
fn exported_name(path: path, id: ast::node_id, _vers: str) -> str {
489489
// FIXME: versioning isn't working yet
490-
ret mangle(path + [path_name(hash)]); // + "@" + vers;
491-
490+
ret mangle(path + [path_name(int::str(id))]); // + "@" + vers;
492491
}
493492

494-
fn mangle_exported_name(ccx: @crate_ctxt, path: path, t: ty::t) -> str {
495-
let hash = get_symbol_hash(ccx, t);
496-
ret exported_name(path, hash, ccx.link_meta.vers);
493+
fn mangle_exported_name(ccx: @crate_ctxt, path: path, id: ast::node_id)
494+
-> str {
495+
ret exported_name(path, id, ccx.link_meta.vers);
497496
}
498497

499498
fn mangle_internal_name_by_type_only(ccx: @crate_ctxt, t: ty::t, name: str) ->

branches/try/src/rustc/middle/trans/base.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t],
19441944
let llfty = type_of_fn_from_ty(ccx, mono_ty);
19451945

19461946
let pt = *pt + [path_name(ccx.names(name))];
1947-
let s = mangle_exported_name(ccx, pt, mono_ty);
1947+
let s = mangle_exported_name(ccx, pt, fn_id.node);
19481948
let lldecl = decl_internal_cdecl_fn(ccx.llmod, s, llfty);
19491949
ccx.monomorphized.insert(hash_id, lldecl);
19501950
ccx.item_symbols.insert(fn_id.node, s);
@@ -4454,7 +4454,7 @@ fn register_fn_full(ccx: @crate_ctxt, sp: span, path: path,
44544454
fn register_fn_fuller(ccx: @crate_ctxt, sp: span, path: path,
44554455
node_id: ast::node_id, node_type: ty::t,
44564456
cc: lib::llvm::CallConv, llfty: TypeRef) -> ValueRef {
4457-
let ps: str = mangle_exported_name(ccx, path, node_type);
4457+
let ps: str = mangle_exported_name(ccx, path, node_id);
44584458
let llfn: ValueRef = decl_fn(ccx.llmod, ps, cc, llfty);
44594459
ccx.item_symbols.insert(node_id, ps);
44604460

@@ -4583,7 +4583,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
45834583
alt check i.node {
45844584
ast::item_const(_, _) {
45854585
let typ = ty::node_id_to_type(ccx.tcx, i.id);
4586-
let s = mangle_exported_name(ccx, my_path, typ);
4586+
let s = mangle_exported_name(ccx, my_path, i.id);
45874587
let g = str::as_c_str(s, {|buf|
45884588
llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, typ), buf)
45894589
});
@@ -4670,7 +4670,7 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
46704670
for vec::each(variants) {|variant|
46714671
let p = path + [path_name(variant.node.name),
46724672
path_name("discrim")];
4673-
let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
4673+
let s = mangle_exported_name(ccx, p, it.id);
46744674
let disr_val = vi[i].disr_val;
46754675
note_unique_llvm_symbol(ccx, s);
46764676
let discrim_gvar = str::as_c_str(s, {|buf|
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn main(args: [str]) {
2+
let one = fn@() -> uint {
3+
enum r { a };
4+
ret a as uint;
5+
};
6+
let two = fn@() -> uint {
7+
enum r { a };
8+
ret a as uint;
9+
};
10+
one(); two();
11+
}

0 commit comments

Comments
 (0)