Fix all occurrences of writing to immutable aliases

You'd be surprised.
This commit is contained in:
Marijn Haverbeke 2011-06-10 12:02:57 +02:00
parent c51c6ba354
commit 798bbd2e22
5 changed files with 20 additions and 19 deletions

View file

@ -806,15 +806,16 @@ fn lookup_in_local_native_mod(&env e, def_id defid, &span sp,
fn lookup_in_local_mod(&env e, def_id defid, &span sp,
&ident id, namespace ns, dir dr) -> option::t[def] {
auto info = e.mod_map.get(defid._1);
if (dr == outside && !ast::is_exported(id, option::get(info.m))) {
if (dr == outside && !ast::is_exported(id, option::get(info.m))) {
// if we're in a native mod, then dr==inside, so info.m is some _mod
ret none[def]; // name is not visible
}
}
alt(info.index.find(id)) {
case (none) { }
case (some(?lst)) {
case (some(?lst_)) {
auto lst = lst_;
while (true) {
alt ({lst}) {
alt (lst) {
case (nil) { break; }
case (cons(?hd, ?tl)) {
auto found = lookup_in_mie(e, hd, ns);
@ -1070,7 +1071,7 @@ fn check_for_collisions(&@env e, &ast::crate c) {
visit::visit_crate(c, (), visit::vtor(v));
}
fn check_mod_name(&env e, &ident name, &list[mod_index_entry] entries) {
fn check_mod_name(&env e, &ident name, list[mod_index_entry] entries) {
auto saw_mod = false; auto saw_type = false; auto saw_value = false;
fn dup(&env e, &span sp, &str word, &ident name) {
@ -1078,7 +1079,7 @@ fn check_mod_name(&env e, &ident name, &list[mod_index_entry] entries) {
}
while (true) {
alt ({entries}) {
alt (entries) {
case (cons(?entry, ?rest)) {
if (!option::is_none(lookup_in_mie(e, entry, ns_value))) {
if (saw_value) { dup(e, mie_span(entry), "", name); }

View file

@ -3285,11 +3285,11 @@ fn copy_val(&@block_ctxt cx,
// FIXME: We always zero out the source. Ideally we would detect the
// case where a variable is always deinitialized by block exit and thus
// doesn't need to be dropped.
fn move_val(&@block_ctxt cx,
copy_action action,
ValueRef dst,
ValueRef src,
&ty::t t) -> result {
fn move_val(@block_ctxt cx,
copy_action action,
ValueRef dst,
ValueRef src,
&ty::t t) -> result {
if (ty::type_is_scalar(cx.fcx.lcx.ccx.tcx, t) ||
ty::type_is_native(cx.fcx.lcx.ccx.tcx, t)) {
ret res(cx, cx.build.Store(src, dst));
@ -5717,7 +5717,7 @@ fn trans_expr_out(&@block_ctxt cx, &@ast::expr e, out_method output)
ret res(sub.res.bcx, load_if_immediate(sub.res.bcx, sub.res.val, t));
}
fn with_out_method(fn(&out_method) -> result work, &@block_ctxt cx,
fn with_out_method(fn(&out_method) -> result work, @block_ctxt cx,
&ast::ann ann, &out_method outer_output) -> result {
auto ccx = cx.fcx.lcx.ccx;
if (outer_output != return) {