Skip to content

Commit 1749d69

Browse files
committed
---
yaml --- r: 2329 b: refs/heads/master c: 3f317ed h: refs/heads/master i: 2327: 998ddd9 v: v3
1 parent bf099ea commit 1749d69

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1c85712db3a647595c57d9f5ad2d4306df1f2d69
2+
refs/heads/master: 3f317ede41d69a8fd5e1690c4ed509a4e826ea11

trunk/src/comp/middle/trans.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn path_name(vec[str] path) -> str {
184184
}
185185

186186

187-
fn mangle_name_by_type(@crate_ctxt ccx, vec[str] path, ty.t t) -> str {
187+
fn get_type_sha1(@crate_ctxt ccx, ty.t t) -> str {
188188
auto hash = "";
189189
alt (ccx.type_sha1s.find(t)) {
190190
case (some[str](?h)) { hash = h; }
@@ -200,9 +200,24 @@ fn mangle_name_by_type(@crate_ctxt ccx, vec[str] path, ty.t t) -> str {
200200
ccx.type_sha1s.insert(t, hash);
201201
}
202202
}
203+
ret hash;
204+
}
205+
206+
fn mangle_name_by_type(@crate_ctxt ccx, vec[str] path, ty.t t) -> str {
207+
auto hash = get_type_sha1(ccx, t);
203208
ret sep() + "rust" + sep() + hash + sep() + path_name(path);
204209
}
205210

211+
fn mangle_name_by_type_only(@crate_ctxt ccx, ty.t t, str name) -> str {
212+
auto f = metadata.def_to_str;
213+
auto cx = @rec(ds=f, tcx=ccx.tcx,
214+
use_abbrevs=false, abbrevs=ccx.type_abbrevs);
215+
auto s = metadata.Encode.ty_str(cx, t);
216+
217+
auto hash = get_type_sha1(ccx, t);
218+
ret sep() + "rust" + sep() + hash + sep() + name + "_" + s;
219+
}
220+
206221
fn mangle_name_by_seq(@crate_ctxt ccx, vec[str] path, str flav) -> str {
207222
ret sep() + "rust" + sep()
208223
+ ccx.names.next(flav) + sep()
@@ -1774,8 +1789,7 @@ fn declare_generic_glue(@local_ctxt cx,
17741789
ty.t t,
17751790
TypeRef llfnty,
17761791
str name) -> ValueRef {
1777-
auto gcx = @rec(path=vec("glue", name) with *cx);
1778-
auto fn_nm = mangle_name_by_seq(cx.ccx, cx.path, "glue");
1792+
auto fn_nm = mangle_name_by_type_only(cx.ccx, t, "glue_" + name);
17791793
fn_nm = sanitize(fn_nm);
17801794
auto llfn = decl_internal_fastcall_fn(cx.ccx.llmod, fn_nm, llfnty);
17811795
ret llfn;

0 commit comments

Comments
 (0)