Inherit mutability through fixed-length vectors.
Fixes #3226. No review (one line bug fix).
This commit is contained in:
parent
f4a5a76aa4
commit
b7c04d152b
@ -797,7 +797,8 @@ impl &mem_categorization_ctxt {
|
||||
|
||||
deref_comp(_) => {
|
||||
// fixed-length vectors have no deref
|
||||
comp(expr, base_cmt, base_cmt.ty, mt.mutbl, mt.ty)
|
||||
let m = self.inherited_mutability(base_cmt.mutbl, mt.mutbl);
|
||||
comp(expr, base_cmt, base_cmt.ty, m, mt.ty)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
fn test1() {
|
||||
let mut ints = [0, ..32];
|
||||
ints[0] += 1;
|
||||
assert ints[0] == 1;
|
||||
}
|
||||
|
||||
fn test2() {
|
||||
let mut ints = [0, ..32];
|
||||
for vec::each_mut(ints) |i| { *i += 22; }
|
||||
for ints.each |i| { assert *i == 22; }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test1();
|
||||
test2();
|
||||
}
|
Loading…
Reference in New Issue
Block a user