Skip to content

Commit a8ff91a

Browse files
committed
Removing interior mut on vectors, round 1
find ./ -type f -name "*.rs" -exec sed -i "s/let mut\(.*\)\[mut[ ]\?/let mut\1\[/g" {} \;
1 parent 7d8ae44 commit a8ff91a

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

src/libcore/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program {
289289

290290
fn read_all(rd: io::Reader) -> ~str {
291291
let buf = io::with_bytes_writer(|wr| {
292-
let mut bytes = [mut 0, ..4096];
292+
let mut bytes = [0, ..4096];
293293
while !rd.eof() {
294294
let nread = rd.read(bytes, bytes.len());
295295
wr.write(bytes.view(0, nread));
@@ -387,7 +387,7 @@ pub fn readclose(fd: c_int) -> ~str {
387387
let file = os::fdopen(fd);
388388
let reader = io::FILE_reader(file, false);
389389
let buf = io::with_bytes_writer(|writer| {
390-
let mut bytes = [mut 0, ..4096];
390+
let mut bytes = [0, ..4096];
391391
while !reader.eof() {
392392
let nread = reader.read(bytes, bytes.len());
393393
writer.write(bytes.view(0, nread));

src/librustdoc/markdown_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn readclose(fd: libc::c_int) -> ~str {
156156
let file = os::fdopen(fd);
157157
let reader = io::FILE_reader(file, false);
158158
let buf = io::with_bytes_writer(|writer| {
159-
let mut bytes = [mut 0, ..4096];
159+
let mut bytes = [0, ..4096];
160160
while !reader.eof() {
161161
let nread = reader.read(bytes, bytes.len());
162162
writer.write(bytes.view(0, nread));

src/test/compile-fail/assign-super.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
let mut x: ~[mut int] = ~[mut 3];
12+
let mut x: ~[mut int] = ~[3];
1313
let y: ~[int] = ~[3];
1414
x = y; //~ ERROR values differ in mutability
1515
}

src/test/compile-fail/borrowck-assign-comp-idx.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
type point = { x: int, y: int };
1212

1313
fn a() {
14-
let mut p = ~[mut 1];
14+
let mut p = ~[1];
1515

1616
// Create an immutable pointer into p's contents:
1717
let _q: &int = &p[0]; //~ NOTE loan of mutable vec content granted here
@@ -25,7 +25,7 @@ fn b() {
2525
// here we alias the mutable vector into an imm slice and try to
2626
// modify the original:
2727

28-
let mut p = ~[mut 1];
28+
let mut p = ~[1];
2929

3030
do borrow(p) { //~ NOTE loan of mutable vec content granted here
3131
p[0] = 5; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
@@ -35,7 +35,7 @@ fn b() {
3535
fn c() {
3636
// Legal because the scope of the borrow does not include the
3737
// modification:
38-
let mut p = ~[mut 1];
38+
let mut p = ~[1];
3939
borrow(p, ||{});
4040
p[0] = 5;
4141
}

src/test/compile-fail/issue-2548.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn main() {
3333
{
3434
let mut res = foo(x);
3535

36-
let mut v = ~[mut];
36+
let mut v = ~[];
3737
v = move ~[mut (move res)] + v; //~ ERROR instantiating a type parameter with an incompatible type (needs `copy`, got `&static`, missing `copy`)
3838
assert (v.len() == 2);
3939
}

src/test/compile-fail/issue-2969.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
fn main()
1313
{
1414
// See #2969 -- error message should be improved
15-
let mut x = [mut 1, 2, 4];
15+
let mut x = [1, 2, 4];
1616
let v : &int = &x[2];
1717
x[2] = 6;
1818
assert *v == 6;

src/test/compile-fail/issue-3243.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// xfail-test
1212
fn function() -> &[mut int] {
13-
let mut x: &static/[mut int] = &[mut 1,2,3];
13+
let mut x: &static/[mut int] = &[1,2,3];
1414
x[0] = 12345;
1515
x //~ ERROR bad
1616
}

0 commit comments

Comments
 (0)