Skip to content

Commit c71dc77

Browse files
ericktbrson
authored andcommitted
rustc: uniquely mangle expr_fn names
two closures in the same function body can end up having the same mangled name. This small patch uses gensym to uniquely name each closure body so there won't be conflicts.
1 parent c756ec0 commit c71dc77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rustc/middle/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ fn trans_expr_fn(bcx: block,
363363
let llfnty = type_of_fn_from_ty(ccx, fty);
364364
let sub_path = vec::append_one(bcx.fcx.path,
365365
path_name(special_idents::anon));
366-
let s = mangle_internal_name_by_path(ccx, sub_path);
366+
let s = mangle_internal_name_by_path_and_seq(ccx, sub_path, ~"expr_fn");
367367
let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty);
368368

369369
let trans_closure_env = fn@(ck: ty::closure_kind) -> Result {

0 commit comments

Comments
 (0)