Skip to content

Commit 6e6798c

Browse files
committed
Bulk-edit mutable -> mut.
1 parent 34283ce commit 6e6798c

File tree

160 files changed

+772
-772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+772
-772
lines changed

doc/keywords.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ else export
88
f32 f64 fail false float fn for
99
i16 i32 i64 i8 if import in int
1010
let log loop
11-
mod mutable
11+
mod mut
1212
native note
1313
obj
1414
prove pure

doc/lib/codemirror-rust.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ CodeMirror.defineMode("rust", function() {
218218
if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block);
219219
if (content == "||") return cont(poplex, pushlex("}", "block"), block);
220220
}
221-
if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
221+
if (content == "mut" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
222222
&& !cx.stream.match("::", false)))
223223
return pass(record_of(expression));
224224
return pass(block);
225225
}
226226
function record_of(comb) {
227227
function ro(type) {
228-
if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);}
228+
if (content == "mut" || content == "with") {cx.marked = "keyword"; return cont(ro);}
229229
if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);}
230230
if (type == ":") return cont(comb, ro);
231231
if (type == "}") return cont();
@@ -317,7 +317,7 @@ CodeMirror.defineMode("rust", function() {
317317
}
318318
function rtype(type) {
319319
if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); }
320-
if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);}
320+
if (content == "mut") {cx.marked = "keyword"; return cont(rtype);}
321321
if (type == "atom") return cont(rtypemaybeparam);
322322
if (type == "op" || type == "obj") return cont(rtype);
323323
if (type == "fn") return cont(fntype);

doc/rust.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ else enum export
217217
fail false fn for
218218
if iface impl import
219219
let log loop
220-
mod mutable
220+
mod mut
221221
native
222222
pure
223223
resource ret
@@ -1527,13 +1527,13 @@ rec_expr : '{' ident ':' expr
15271527
A _[record](#record-types) expression_ is one or more comma-separated
15281528
name-value pairs enclosed by braces. A fieldname can be any identifier
15291529
(including keywords), and is separated from its value expression by a
1530-
colon. To indicate that a field is mutable, the `mutable` keyword is
1530+
colon. To indicate that a field is mutable, the `mut` keyword is
15311531
written before its name.
15321532

15331533
~~~~
15341534
{x: 10f, y: 20f};
15351535
{name: "Joe", age: 35u, score: 100_000};
1536-
{ident: "X", mutable count: 0u};
1536+
{ident: "X", mut count: 0u};
15371537
~~~~
15381538

15391539
The order of the fields in a record expression is significant, and
@@ -1586,19 +1586,19 @@ expression on the left of the dot.
15861586
### Vector expressions
15871587

15881588
~~~~~~~~{.ebnf .gram}
1589-
vec_expr : '[' "mutable" ? [ expr [ ',' expr ] * ] ? ']'
1589+
vec_expr : '[' "mut" ? [ expr [ ',' expr ] * ] ? ']'
15901590
~~~~~~~~
15911591

15921592
A _[vector](#vector-types) expression_ is written by enclosing zero or
15931593
more comma-separated expressions of uniform type in square brackets.
1594-
The keyword `mutable` can be written after the opening bracket to
1594+
The keyword `mut` can be written after the opening bracket to
15951595
indicate that the elements of the resulting vector may be mutated.
15961596
When no mutability is specified, the vector is immutable.
15971597

15981598
~~~~
15991599
[1, 2, 3, 4];
16001600
["a", "b", "c", "d"];
1601-
[mutable 0u8, 0u8, 0u8, 0u8];
1601+
[mut 0u8, 0u8, 0u8, 0u8];
16021602
~~~~
16031603

16041604
### Index expressions
@@ -1622,7 +1622,7 @@ task in a _failing state_.
16221622
# task::run(builder) {||
16231623
16241624
[1, 2, 3, 4][0];
1625-
[mutable 'x', 'y'][1] = 'z';
1625+
[mut 'x', 'y'][1] = 'z';
16261626
["a", "b"][10]; // fails
16271627
16281628
# }
@@ -1904,11 +1904,11 @@ argument to a function to be copied and passed by value.
19041904
An example of a copy expression:
19051905

19061906
~~~~
1907-
fn mutate(vec: [mutable int]) {
1907+
fn mutate(vec: [mut int]) {
19081908
vec[0] = 10;
19091909
}
19101910
1911-
let v = [mutable 1,2,3];
1911+
let v = [mut 1,2,3];
19121912
19131913
mutate(copy v); // Pass a copy
19141914

doc/tutorial.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ more detail later on (the `T`s here stand for any other type):
366366
`[T]`
367367
: Vector type.
368368

369-
`[mutable T]`
369+
`[mut T]`
370370
: Mutable vector type.
371371

372372
`(T1, T2)`
@@ -994,10 +994,10 @@ Fields that you want to mutate must be explicitly marked as such. For
994994
example...
995995

996996
~~~~
997-
type stack = {content: [int], mutable head: uint};
997+
type stack = {content: [int], mut head: uint};
998998
~~~~
999999

1000-
With such a type, you can do `mystack.head += 1u`. If `mutable` were
1000+
With such a type, you can do `mystack.head += 1u`. If `mut` were
10011001
omitted from the type, such an assignment would result in a type
10021002
error.
10031003

@@ -1240,12 +1240,12 @@ become the sole owner of the box.
12401240

12411241
### Mutability
12421242

1243-
All pointer types have a mutable variant, written `@mutable TYPE` or
1244-
`~mutable TYPE`. Given such a pointer, you can write to its contents
1243+
All pointer types have a mutable variant, written `@mut TYPE` or
1244+
`~mut TYPE`. Given such a pointer, you can write to its contents
12451245
by combining the dereference operator with a mutating action.
12461246

12471247
~~~~
1248-
fn increase_contents(pt: @mutable int) {
1248+
fn increase_contents(pt: @mut int) {
12491249
*pt += 1;
12501250
}
12511251
~~~~
@@ -1268,9 +1268,9 @@ if myvec[1] { io::println("boom"); }
12681268
~~~~
12691269

12701270
By default, vectors are immutable—you can not replace their elements.
1271-
The type written as `[mutable TYPE]` is a vector with mutable
1272-
elements. Mutable vector literals are written `[mutable]` (empty) or
1273-
`[mutable 1, 2, 3]` (with elements).
1271+
The type written as `[mut TYPE]` is a vector with mutable
1272+
elements. Mutable vector literals are written `[mut]` (empty) or
1273+
`[mut 1, 2, 3]` (with elements).
12741274

12751275
The `+` operator means concatenation when applied to vector types.
12761276
Growing a vector in Rust is not as inefficient as it looks :
@@ -1398,7 +1398,7 @@ to pessimistically assume a value will get mutated, even though it is
13981398
not sure.
13991399

14001400
~~~~
1401-
fn for_each(v: [mutable @int], iter: fn(@int)) {
1401+
fn for_each(v: [mut @int], iter: fn(@int)) {
14021402
for elt in v { iter(elt); }
14031403
}
14041404
~~~~
@@ -1413,15 +1413,15 @@ reference count is considered cheap enough to not warn about it).
14131413
## The copy operator
14141414

14151415
If the `for_each` function given above were to take a vector of
1416-
`{mutable a: int}` instead of `@int`, it would not be able to
1416+
`{mut a: int}` instead of `@int`, it would not be able to
14171417
implicitly copy, since if the `iter` function changes a copy of a
14181418
mutable record, the changes won't be visible in the record itself. If
14191419
we *do* want to allow copies there, we have to explicitly allow it
14201420
with the `copy` operator:
14211421

14221422
~~~~
1423-
type mutrec = {mutable x: int};
1424-
fn for_each(v: [mutable mutrec], iter: fn(mutrec)) {
1423+
type mutrec = {mut x: int};
1424+
fn for_each(v: [mut mutrec], iter: fn(mutrec)) {
14251425
for elt in v { iter(copy elt); }
14261426
}
14271427
~~~~
@@ -1529,7 +1529,7 @@ Generic `type` and `enum` declarations follow the same pattern:
15291529
~~~~
15301530
type circular_buf<T> = {start: uint,
15311531
end: uint,
1532-
buf: [mutable T]};
1532+
buf: [mut T]};
15331533
15341534
enum option<T> { some(T), none }
15351535
~~~~
@@ -2315,14 +2315,14 @@ microsecond-resolution timer.
23152315

23162316
~~~~
23172317
use std;
2318-
type timeval = {mutable tv_sec: uint,
2319-
mutable tv_usec: uint};
2318+
type timeval = {mut tv_sec: uint,
2319+
mut tv_usec: uint};
23202320
#[nolink]
23212321
native mod libc {
23222322
fn gettimeofday(tv: *timeval, tz: *()) -> i32;
23232323
}
23242324
fn unix_time_in_microseconds() -> u64 unsafe {
2325-
let x = {mutable tv_sec: 0u, mutable tv_usec: 0u};
2325+
let x = {mut tv_sec: 0u, mut tv_usec: 0u};
23262326
libc::gettimeofday(ptr::addr_of(x), ptr::null());
23272327
ret (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64);
23282328
}

src/cargo/cargo.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type source = {
4343
sig: option<str>,
4444
key: option<str>,
4545
keyfp: option<str>,
46-
mutable packages: [package]
46+
mut packages: [package]
4747
};
4848

4949
type cargo = {
@@ -117,10 +117,10 @@ fn load_pkg(filename: str) -> option<pkg> {
117117
let handler = diagnostic::mk_handler(none);
118118
let sess = @{
119119
cm: cm,
120-
mutable next_id: 1,
120+
mut next_id: 1,
121121
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
122-
mutable chpos: 0u,
123-
mutable byte_pos: 0u
122+
mut chpos: 0u,
123+
mut byte_pos: 0u
124124
};
125125
let c = parser::parse_crate_from_crate_file(filename, [], sess);
126126

@@ -214,7 +214,7 @@ fn parse_source(name: str, j: json::json) -> source {
214214
_ { none }
215215
};
216216
ret { name: name, url: url, sig: sig, key: key, keyfp: keyfp,
217-
mutable packages: [] };
217+
mut packages: [] };
218218
}
219219
_ { fail "Needed dict value in source."; }
220220
};

src/fuzzer/fuzzer.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn safe_to_steal_ty(t: @ast::ty, tm: test_mode) -> bool {
119119

120120
// Not type-parameterized: https://github.com/mozilla/rust/issues/898 (FIXED)
121121
fn stash_expr_if(c: fn@(@ast::expr, test_mode)->bool,
122-
es: @mutable [ast::expr],
122+
es: @mut [ast::expr],
123123
e: @ast::expr,
124124
tm: test_mode) {
125125
if c(e, tm) {
@@ -128,7 +128,7 @@ fn stash_expr_if(c: fn@(@ast::expr, test_mode)->bool,
128128
}
129129

130130
fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
131-
es: @mutable [ast::ty],
131+
es: @mut [ast::ty],
132132
e: @ast::ty,
133133
tm: test_mode) {
134134
if c(e, tm) {
@@ -139,8 +139,8 @@ fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
139139
type stolen_stuff = {exprs: [ast::expr], tys: [ast::ty]};
140140

141141
fn steal(crate: ast::crate, tm: test_mode) -> stolen_stuff {
142-
let exprs = @mutable [];
143-
let tys = @mutable [];
142+
let exprs = @mut [];
143+
let tys = @mut [];
144144
let v = visit::mk_simple_visitor(@{
145145
visit_expr: bind stash_expr_if(safe_to_steal_expr, exprs, _, tm),
146146
visit_ty: bind stash_ty_if(safe_to_steal_ty, tys, _, tm)
@@ -176,8 +176,8 @@ fn safe_to_replace_ty(t: ast::ty_, _tm: test_mode) -> bool {
176176
// Replace the |i|th expr (in fold order) of |crate| with |newexpr|.
177177
fn replace_expr_in_crate(crate: ast::crate, i: uint, newexpr: ast::expr, tm: test_mode) ->
178178
ast::crate {
179-
let j: @mutable uint = @mutable 0u;
180-
fn fold_expr_rep(j_: @mutable uint, i_: uint, newexpr_: ast::expr_,
179+
let j: @mut uint = @mut 0u;
180+
fn fold_expr_rep(j_: @mut uint, i_: uint, newexpr_: ast::expr_,
181181
original: ast::expr_, fld: fold::ast_fold, tm_: test_mode) ->
182182
ast::expr_ {
183183
*j_ += 1u;
@@ -199,8 +199,8 @@ fn replace_expr_in_crate(crate: ast::crate, i: uint, newexpr: ast::expr, tm: tes
199199
// Replace the |i|th ty (in fold order) of |crate| with |newty|.
200200
fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::ty, tm: test_mode) ->
201201
ast::crate {
202-
let j: @mutable uint = @mutable 0u;
203-
fn fold_ty_rep(j_: @mutable uint, i_: uint, newty_: ast::ty_,
202+
let j: @mut uint = @mut 0u;
203+
fn fold_ty_rep(j_: @mut uint, i_: uint, newty_: ast::ty_,
204204
original: ast::ty_, fld: fold::ast_fold, tm_: test_mode) ->
205205
ast::ty_ {
206206
*j_ += 1u;
@@ -403,10 +403,10 @@ fn parse_and_print(code: @str) -> str {
403403
let handler = diagnostic::mk_handler(none);
404404
let sess = @{
405405
cm: cm,
406-
mutable next_id: 1,
406+
mut next_id: 1,
407407
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
408-
mutable chpos: 0u,
409-
mutable byte_pos: 0u
408+
mut chpos: 0u,
409+
mut byte_pos: 0u
410410
};
411411
write_file(filename, *code);
412412
let crate = parser::parse_crate_from_source_str(
@@ -422,8 +422,8 @@ fn parse_and_print(code: @str) -> str {
422422
}
423423

424424
fn has_raw_pointers(c: ast::crate) -> bool {
425-
let has_rp = @mutable false;
426-
fn visit_ty(flag: @mutable bool, t: @ast::ty) {
425+
let has_rp = @mut false;
426+
fn visit_ty(flag: @mut bool, t: @ast::ty) {
427427
alt t.node {
428428
ast::ty_ptr(_) { *flag = true; }
429429
_ { }
@@ -549,10 +549,10 @@ fn check_variants(files: [str], cx: context) {
549549
let handler = diagnostic::mk_handler(none);
550550
let sess = @{
551551
cm: cm,
552-
mutable next_id: 1,
552+
mut next_id: 1,
553553
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
554-
mutable chpos: 0u,
555-
mutable byte_pos: 0u
554+
mut chpos: 0u,
555+
mut byte_pos: 0u
556556
};
557557
let crate =
558558
parser::parse_crate_from_source_str(

src/fuzzer/rand_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn choice<T: copy>(r : rand::rng, v : [T]) -> T { assert vec::len(v) != 0u; v[un
1212
fn unlikely(r : rand::rng, n : uint) -> bool { under(r, n) == 0u }
1313

1414
// shuffle a vec in place
15-
fn shuffle<T>(r : rand::rng, &v : [mutable T]) {
15+
fn shuffle<T>(r : rand::rng, &v : [mut T]) {
1616
let i = vec::len(v);
1717
while i >= 2u {
1818
// Loop invariant: elements with index >= i have been locked in place.
@@ -73,7 +73,7 @@ fn main()
7373
log(error, choice(r, [10, 20, 30]));
7474
log(error, if unlikely(r, 5u) { "unlikely" } else { "likely" });
7575

76-
let a = [mutable 1, 2, 3];
76+
let a = [mut 1, 2, 3];
7777
shuffle(r, a);
7878
log(error, a);
7979

src/libcore/future.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export spawn;
2424

2525
#[doc = "The future type"]
2626
enum future<A> = {
27-
mutable v: either<@A, fn@() -> A>
27+
mut v: either<@A, fn@() -> A>
2828
};
2929

3030
#[doc = "Methods on the `future` type"]
@@ -52,7 +52,7 @@ fn from_value<A>(+val: A) -> future<A> {
5252
"];
5353

5454
future({
55-
mutable v: either::left(@val)
55+
mut v: either::left(@val)
5656
})
5757
}
5858

@@ -79,7 +79,7 @@ fn from_fn<A>(f: fn@() -> A) -> future<A> {
7979
"];
8080

8181
future({
82-
mutable v: either::right(f)
82+
mut v: either::right(f)
8383
})
8484
}
8585

0 commit comments

Comments
 (0)