Pass all arguments by reference, make immut alias mode equiv to value

Arguments that can't be safely referenced will be implicitly copied.

(Warnings for expensive copies will be forthcoming.)

This will allow us to get rid of most of the ampersands in function
signatures. See [1].

[1] https://mail.mozilla.org/pipermail/rust-dev/2011-September/000759.html
This commit is contained in:
Marijn Haverbeke 2011-09-07 15:13:19 +02:00
parent 476bbca87a
commit 4be7e1e5cd
7 changed files with 188 additions and 158 deletions

View file

@ -63,7 +63,7 @@ fn trans_obj(cx: @local_ctxt, sp: &span, ob: &ast::_obj,
ty::ret_ty_of_fn(ccx.tcx, ctor_id), fn_args,
ty_params);
let arg_tys: [ty::arg] = arg_tys_of_fn(ccx, ctor_id);
copy_args_to_allocas(fcx, bcx, fn_args, arg_tys);
copy_args_to_allocas(fcx, bcx, fn_args, arg_tys, true);
// Pick up the type of this object by looking at our own output type, that
// is, the output type of the object constructor we're building.