Skip to content

Commit e558ff9

Browse files
committed
rustc: Allow callees to use alias args
1 parent 7f85945 commit e558ff9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/comp/middle/trans.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,12 +1885,15 @@ fn copy_args_to_allocas(@block_ctxt cx, vec[ast.arg] args,
18851885
let uint arg_n = 0u;
18861886

18871887
for (ast.arg aarg in args) {
1888-
auto arg_t = type_of_arg(cx.fcx.ccx, arg_tys.(arg_n));
1889-
auto alloca = cx.build.Alloca(arg_t);
1890-
auto argval = cx.fcx.llargs.get(aarg.id);
1891-
cx.build.Store(argval, alloca);
1892-
// Overwrite the llargs entry for this arg with its alloca.
1893-
cx.fcx.llargs.insert(aarg.id, alloca);
1888+
if (aarg.mode != ast.alias) {
1889+
auto arg_t = type_of_arg(cx.fcx.ccx, arg_tys.(arg_n));
1890+
auto alloca = cx.build.Alloca(arg_t);
1891+
auto argval = cx.fcx.llargs.get(aarg.id);
1892+
cx.build.Store(argval, alloca);
1893+
// Overwrite the llargs entry for this arg with its alloca.
1894+
cx.fcx.llargs.insert(aarg.id, alloca);
1895+
}
1896+
18941897
arg_n += 1u;
18951898
}
18961899
}

0 commit comments

Comments
 (0)