Rename alias to reference in docs and error messages
Update docs to reflect new approach to aliases
This commit is contained in:
parent
bcf60c6600
commit
982a1a4783
7 changed files with 45 additions and 51 deletions
|
|
@ -266,9 +266,10 @@ fn check_call(cx: ctx, f: @ast::expr, args: [@ast::expr], sc: scope) ->
|
|||
alt r.root_var {
|
||||
some(root) {
|
||||
if node == root && cant_copy(cx, r) {
|
||||
cx.tcx.sess.span_err(args[arg].span,
|
||||
"passing a mutable alias to a \
|
||||
variable that roots another alias");
|
||||
cx.tcx.sess.span_err
|
||||
(args[arg].span,
|
||||
"passing a mutable reference to a \
|
||||
variable that roots another reference");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -415,7 +416,7 @@ fn test_scope(cx: ctx, sc: scope, r: restrict, p: ast::path) {
|
|||
}
|
||||
};
|
||||
cx.tcx.sess.span_err(msg.span,
|
||||
msg.msg + " will invalidate alias " +
|
||||
msg.msg + " will invalidate reference " +
|
||||
ast_util::path_name(p) +
|
||||
", which is still used");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,15 +130,15 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) -> mut_map {
|
|||
ret cx.mut_map;
|
||||
}
|
||||
|
||||
tag msg { msg_assign; msg_move_out; msg_mut_alias; }
|
||||
tag msg { msg_assign; msg_move_out; msg_mut_ref; }
|
||||
|
||||
fn mk_err(cx: @ctx, span: syntax::codemap::span, msg: msg, name: str) {
|
||||
cx.tcx.sess.span_err(span,
|
||||
alt msg {
|
||||
msg_assign. { "assigning to " + name }
|
||||
msg_move_out. { "moving out of " + name }
|
||||
msg_mut_alias. {
|
||||
"passing " + name + " by mutable alias"
|
||||
msg_mut_ref. {
|
||||
"passing " + name + " by mutable reference"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ fn check_call(cx: @ctx, f: @expr, args: [@expr]) {
|
|||
ty::type_autoderef(cx.tcx, ty::expr_ty(cx.tcx, f)));
|
||||
let i = 0u;
|
||||
for arg_t: ty::arg in arg_ts {
|
||||
if arg_t.mode != by_ref { check_lval(cx, args[i], msg_mut_alias); }
|
||||
if arg_t.mode != by_ref { check_lval(cx, args[i], msg_mut_ref); }
|
||||
i += 1u;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue