Bulk-edit mutable -> mut.

This commit is contained in:
Graydon Hoare 2012-03-26 18:35:18 -07:00
parent 34283ce7e8
commit 6e6798c4e1
160 changed files with 772 additions and 772 deletions

View file

@ -8,7 +8,7 @@ else export
f32 f64 fail false float fn for
i16 i32 i64 i8 if import in int
let log loop
mod mutable
mod mut
native note
obj
prove pure

View file

@ -218,14 +218,14 @@ CodeMirror.defineMode("rust", function() {
if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block);
if (content == "||") return cont(poplex, pushlex("}", "block"), block);
}
if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
if (content == "mut" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
&& !cx.stream.match("::", false)))
return pass(record_of(expression));
return pass(block);
}
function record_of(comb) {
function ro(type) {
if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);}
if (content == "mut" || content == "with") {cx.marked = "keyword"; return cont(ro);}
if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);}
if (type == ":") return cont(comb, ro);
if (type == "}") return cont();
@ -317,7 +317,7 @@ CodeMirror.defineMode("rust", function() {
}
function rtype(type) {
if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); }
if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);}
if (content == "mut") {cx.marked = "keyword"; return cont(rtype);}
if (type == "atom") return cont(rtypemaybeparam);
if (type == "op" || type == "obj") return cont(rtype);
if (type == "fn") return cont(fntype);

View file

@ -217,7 +217,7 @@ else enum export
fail false fn for
if iface impl import
let log loop
mod mutable
mod mut
native
pure
resource ret
@ -1527,13 +1527,13 @@ rec_expr : '{' ident ':' expr
A _[record](#record-types) expression_ is one or more comma-separated
name-value pairs enclosed by braces. A fieldname can be any identifier
(including keywords), and is separated from its value expression by a
colon. To indicate that a field is mutable, the `mutable` keyword is
colon. To indicate that a field is mutable, the `mut` keyword is
written before its name.
~~~~
{x: 10f, y: 20f};
{name: "Joe", age: 35u, score: 100_000};
{ident: "X", mutable count: 0u};
{ident: "X", mut count: 0u};
~~~~
The order of the fields in a record expression is significant, and
@ -1586,19 +1586,19 @@ expression on the left of the dot.
### Vector expressions
~~~~~~~~{.ebnf .gram}
vec_expr : '[' "mutable" ? [ expr [ ',' expr ] * ] ? ']'
vec_expr : '[' "mut" ? [ expr [ ',' expr ] * ] ? ']'
~~~~~~~~
A _[vector](#vector-types) expression_ is written by enclosing zero or
more comma-separated expressions of uniform type in square brackets.
The keyword `mutable` can be written after the opening bracket to
The keyword `mut` can be written after the opening bracket to
indicate that the elements of the resulting vector may be mutated.
When no mutability is specified, the vector is immutable.
~~~~
[1, 2, 3, 4];
["a", "b", "c", "d"];
[mutable 0u8, 0u8, 0u8, 0u8];
[mut 0u8, 0u8, 0u8, 0u8];
~~~~
### Index expressions
@ -1622,7 +1622,7 @@ task in a _failing state_.
# task::run(builder) {||
[1, 2, 3, 4][0];
[mutable 'x', 'y'][1] = 'z';
[mut 'x', 'y'][1] = 'z';
["a", "b"][10]; // fails
# }
@ -1904,11 +1904,11 @@ argument to a function to be copied and passed by value.
An example of a copy expression:
~~~~
fn mutate(vec: [mutable int]) {
fn mutate(vec: [mut int]) {
vec[0] = 10;
}
let v = [mutable 1,2,3];
let v = [mut 1,2,3];
mutate(copy v); // Pass a copy

View file

@ -366,7 +366,7 @@ more detail later on (the `T`s here stand for any other type):
`[T]`
: Vector type.
`[mutable T]`
`[mut T]`
: Mutable vector type.
`(T1, T2)`
@ -994,10 +994,10 @@ Fields that you want to mutate must be explicitly marked as such. For
example...
~~~~
type stack = {content: [int], mutable head: uint};
type stack = {content: [int], mut head: uint};
~~~~
With such a type, you can do `mystack.head += 1u`. If `mutable` were
With such a type, you can do `mystack.head += 1u`. If `mut` were
omitted from the type, such an assignment would result in a type
error.
@ -1240,12 +1240,12 @@ become the sole owner of the box.
### Mutability
All pointer types have a mutable variant, written `@mutable TYPE` or
`~mutable TYPE`. Given such a pointer, you can write to its contents
All pointer types have a mutable variant, written `@mut TYPE` or
`~mut TYPE`. Given such a pointer, you can write to its contents
by combining the dereference operator with a mutating action.
~~~~
fn increase_contents(pt: @mutable int) {
fn increase_contents(pt: @mut int) {
*pt += 1;
}
~~~~
@ -1268,9 +1268,9 @@ if myvec[1] { io::println("boom"); }
~~~~
By default, vectors are immutable—you can not replace their elements.
The type written as `[mutable TYPE]` is a vector with mutable
elements. Mutable vector literals are written `[mutable]` (empty) or
`[mutable 1, 2, 3]` (with elements).
The type written as `[mut TYPE]` is a vector with mutable
elements. Mutable vector literals are written `[mut]` (empty) or
`[mut 1, 2, 3]` (with elements).
The `+` operator means concatenation when applied to vector types.
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
not sure.
~~~~
fn for_each(v: [mutable @int], iter: fn(@int)) {
fn for_each(v: [mut @int], iter: fn(@int)) {
for elt in v { iter(elt); }
}
~~~~
@ -1413,15 +1413,15 @@ reference count is considered cheap enough to not warn about it).
## The copy operator
If the `for_each` function given above were to take a vector of
`{mutable a: int}` instead of `@int`, it would not be able to
`{mut a: int}` instead of `@int`, it would not be able to
implicitly copy, since if the `iter` function changes a copy of a
mutable record, the changes won't be visible in the record itself. If
we *do* want to allow copies there, we have to explicitly allow it
with the `copy` operator:
~~~~
type mutrec = {mutable x: int};
fn for_each(v: [mutable mutrec], iter: fn(mutrec)) {
type mutrec = {mut x: int};
fn for_each(v: [mut mutrec], iter: fn(mutrec)) {
for elt in v { iter(copy elt); }
}
~~~~
@ -1529,7 +1529,7 @@ Generic `type` and `enum` declarations follow the same pattern:
~~~~
type circular_buf<T> = {start: uint,
end: uint,
buf: [mutable T]};
buf: [mut T]};
enum option<T> { some(T), none }
~~~~
@ -2315,14 +2315,14 @@ microsecond-resolution timer.
~~~~
use std;
type timeval = {mutable tv_sec: uint,
mutable tv_usec: uint};
type timeval = {mut tv_sec: uint,
mut tv_usec: uint};
#[nolink]
native mod libc {
fn gettimeofday(tv: *timeval, tz: *()) -> i32;
}
fn unix_time_in_microseconds() -> u64 unsafe {
let x = {mutable tv_sec: 0u, mutable tv_usec: 0u};
let x = {mut tv_sec: 0u, mut tv_usec: 0u};
libc::gettimeofday(ptr::addr_of(x), ptr::null());
ret (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64);
}

View file

@ -43,7 +43,7 @@ type source = {
sig: option<str>,
key: option<str>,
keyfp: option<str>,
mutable packages: [package]
mut packages: [package]
};
type cargo = {
@ -117,10 +117,10 @@ fn load_pkg(filename: str) -> option<pkg> {
let handler = diagnostic::mk_handler(none);
let sess = @{
cm: cm,
mutable next_id: 1,
mut next_id: 1,
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
mutable chpos: 0u,
mutable byte_pos: 0u
mut chpos: 0u,
mut byte_pos: 0u
};
let c = parser::parse_crate_from_crate_file(filename, [], sess);
@ -214,7 +214,7 @@ fn parse_source(name: str, j: json::json) -> source {
_ { none }
};
ret { name: name, url: url, sig: sig, key: key, keyfp: keyfp,
mutable packages: [] };
mut packages: [] };
}
_ { fail "Needed dict value in source."; }
};

View file

@ -119,7 +119,7 @@ fn safe_to_steal_ty(t: @ast::ty, tm: test_mode) -> bool {
// Not type-parameterized: https://github.com/mozilla/rust/issues/898 (FIXED)
fn stash_expr_if(c: fn@(@ast::expr, test_mode)->bool,
es: @mutable [ast::expr],
es: @mut [ast::expr],
e: @ast::expr,
tm: test_mode) {
if c(e, tm) {
@ -128,7 +128,7 @@ fn stash_expr_if(c: fn@(@ast::expr, test_mode)->bool,
}
fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
es: @mutable [ast::ty],
es: @mut [ast::ty],
e: @ast::ty,
tm: test_mode) {
if c(e, tm) {
@ -139,8 +139,8 @@ fn stash_ty_if(c: fn@(@ast::ty, test_mode)->bool,
type stolen_stuff = {exprs: [ast::expr], tys: [ast::ty]};
fn steal(crate: ast::crate, tm: test_mode) -> stolen_stuff {
let exprs = @mutable [];
let tys = @mutable [];
let exprs = @mut [];
let tys = @mut [];
let v = visit::mk_simple_visitor(@{
visit_expr: bind stash_expr_if(safe_to_steal_expr, exprs, _, tm),
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 {
// Replace the |i|th expr (in fold order) of |crate| with |newexpr|.
fn replace_expr_in_crate(crate: ast::crate, i: uint, newexpr: ast::expr, tm: test_mode) ->
ast::crate {
let j: @mutable uint = @mutable 0u;
fn fold_expr_rep(j_: @mutable uint, i_: uint, newexpr_: ast::expr_,
let j: @mut uint = @mut 0u;
fn fold_expr_rep(j_: @mut uint, i_: uint, newexpr_: ast::expr_,
original: ast::expr_, fld: fold::ast_fold, tm_: test_mode) ->
ast::expr_ {
*j_ += 1u;
@ -199,8 +199,8 @@ fn replace_expr_in_crate(crate: ast::crate, i: uint, newexpr: ast::expr, tm: tes
// Replace the |i|th ty (in fold order) of |crate| with |newty|.
fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::ty, tm: test_mode) ->
ast::crate {
let j: @mutable uint = @mutable 0u;
fn fold_ty_rep(j_: @mutable uint, i_: uint, newty_: ast::ty_,
let j: @mut uint = @mut 0u;
fn fold_ty_rep(j_: @mut uint, i_: uint, newty_: ast::ty_,
original: ast::ty_, fld: fold::ast_fold, tm_: test_mode) ->
ast::ty_ {
*j_ += 1u;
@ -403,10 +403,10 @@ fn parse_and_print(code: @str) -> str {
let handler = diagnostic::mk_handler(none);
let sess = @{
cm: cm,
mutable next_id: 1,
mut next_id: 1,
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
mutable chpos: 0u,
mutable byte_pos: 0u
mut chpos: 0u,
mut byte_pos: 0u
};
write_file(filename, *code);
let crate = parser::parse_crate_from_source_str(
@ -422,8 +422,8 @@ fn parse_and_print(code: @str) -> str {
}
fn has_raw_pointers(c: ast::crate) -> bool {
let has_rp = @mutable false;
fn visit_ty(flag: @mutable bool, t: @ast::ty) {
let has_rp = @mut false;
fn visit_ty(flag: @mut bool, t: @ast::ty) {
alt t.node {
ast::ty_ptr(_) { *flag = true; }
_ { }
@ -549,10 +549,10 @@ fn check_variants(files: [str], cx: context) {
let handler = diagnostic::mk_handler(none);
let sess = @{
cm: cm,
mutable next_id: 1,
mut next_id: 1,
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
mutable chpos: 0u,
mutable byte_pos: 0u
mut chpos: 0u,
mut byte_pos: 0u
};
let crate =
parser::parse_crate_from_source_str(

View file

@ -12,7 +12,7 @@ fn choice<T: copy>(r : rand::rng, v : [T]) -> T { assert vec::len(v) != 0u; v[un
fn unlikely(r : rand::rng, n : uint) -> bool { under(r, n) == 0u }
// shuffle a vec in place
fn shuffle<T>(r : rand::rng, &v : [mutable T]) {
fn shuffle<T>(r : rand::rng, &v : [mut T]) {
let i = vec::len(v);
while i >= 2u {
// Loop invariant: elements with index >= i have been locked in place.
@ -73,7 +73,7 @@ fn main()
log(error, choice(r, [10, 20, 30]));
log(error, if unlikely(r, 5u) { "unlikely" } else { "likely" });
let a = [mutable 1, 2, 3];
let a = [mut 1, 2, 3];
shuffle(r, a);
log(error, a);

View file

@ -24,7 +24,7 @@ export spawn;
#[doc = "The future type"]
enum future<A> = {
mutable v: either<@A, fn@() -> A>
mut v: either<@A, fn@() -> A>
};
#[doc = "Methods on the `future` type"]
@ -52,7 +52,7 @@ fn from_value<A>(+val: A) -> future<A> {
"];
future({
mutable v: either::left(@val)
mut v: either::left(@val)
})
}
@ -79,7 +79,7 @@ fn from_fn<A>(f: fn@() -> A) -> future<A> {
"];
future({
mutable v: either::right(f)
mut v: either::right(f)
})
}

View file

@ -174,10 +174,10 @@ fn convert_whence(whence: seek_style) -> i32 {
impl of reader for *libc::FILE {
fn read_bytes(len: uint) -> [u8] unsafe {
let mut buf : [mutable u8] = [mutable];
let mut buf : [mut u8] = [mut];
vec::reserve(buf, len);
vec::as_mut_buf(buf) {|b|
let read = libc::fread(b as *mutable c_void, 1u,
let read = libc::fread(b as *mut c_void, 1u,
len, self);
vec::unsafe::set_len(buf, read);
}
@ -237,7 +237,7 @@ fn file_reader(path: str) -> result<reader, str> {
// Byte buffer readers
// TODO: const u8, but this fails with rustboot.
type byte_buf = {buf: [u8], mutable pos: uint, len: uint};
type byte_buf = {buf: [u8], mut pos: uint, len: uint};
impl of reader for byte_buf {
fn read_bytes(len: uint) -> [u8] {
@ -268,7 +268,7 @@ fn bytes_reader(bytes: [u8]) -> reader {
}
fn bytes_reader_between(bytes: [u8], start: uint, end: uint) -> reader {
{buf: bytes, mutable pos: start, len: end} as reader
{buf: bytes, mut pos: start, len: end} as reader
}
fn with_bytes_reader<t>(bytes: [u8], f: fn(reader) -> t) -> t {
@ -514,14 +514,14 @@ fn stderr() -> writer { fd_writer(libc::STDERR_FILENO as c_int, false) }
fn print(s: str) { stdout().write_str(s); }
fn println(s: str) { stdout().write_line(s); }
type mem_buffer = @{mutable buf: [mutable u8],
mutable pos: uint};
type mem_buffer = @{mut buf: [mut u8],
mut pos: uint};
impl of writer for mem_buffer {
fn write(v: [const u8]) {
// Fast path.
if self.pos == vec::len(self.buf) {
for b: u8 in v { self.buf += [mutable b]; }
for b: u8 in v { self.buf += [mut b]; }
self.pos += vec::len(v);
ret;
}
@ -531,7 +531,7 @@ impl of writer for mem_buffer {
while vpos < vlen {
let b = v[vpos];
if self.pos == vec::len(self.buf) {
self.buf += [mutable b];
self.buf += [mut b];
} else { self.buf[self.pos] = b; }
self.pos += 1u;
vpos += 1u;
@ -547,7 +547,7 @@ impl of writer for mem_buffer {
}
fn mem_buffer() -> mem_buffer {
@{mutable buf: [mutable], mutable pos: 0u}
@{mut buf: [mut], mut pos: 0u}
}
fn mem_buffer_writer(b: mem_buffer) -> writer { b as writer }
fn mem_buffer_buf(b: mem_buffer) -> [u8] { vec::from_mut(b.buf) }

View file

@ -346,17 +346,17 @@ mod types {
type LPCWSTR = *WCHAR;
type LPCSTR = *CHAR;
type LPWSTR = *mutable WCHAR;
type LPSTR = *mutable CHAR;
type LPWSTR = *mut WCHAR;
type LPSTR = *mut CHAR;
// Not really, but opaque to us.
type LPSECURITY_ATTRIBUTES = LPVOID;
type LPVOID = *mutable c_void;
type LPWORD = *mutable WORD;
type LPVOID = *mut c_void;
type LPWORD = *mut WORD;
type LRESULT = LONG_PTR;
type PBOOL = *mutable BOOL;
type PBOOL = *mut BOOL;
type WCHAR = wchar_t;
type WORD = u16;
}
@ -757,7 +757,7 @@ mod funcs {
fn setbuf(stream: *FILE, buf: *c_char);
// Omitted: printf and scanf variants.
fn fgetc(stream: *FILE) -> c_int;
fn fgets(buf: *mutable c_char, n: c_int,
fn fgets(buf: *mut c_char, n: c_int,
stream: *FILE) -> *c_char;
fn fputc(c: c_int, stream: *FILE) -> c_int;
fn fputs(s: *c_char, stream: *FILE) -> *c_char;
@ -769,7 +769,7 @@ mod funcs {
// Omitted: putc, putchar (might be macros).
fn puts(s: *c_char) -> c_int;
fn ungetc(c: c_int, stream: *FILE) -> c_int;
fn fread(ptr: *mutable c_void, size: size_t,
fn fread(ptr: *mut c_void, size: size_t,
nobj: size_t, stream: *FILE) -> size_t;
fn fwrite(ptr: *c_void, size: size_t,
nobj: size_t, stream: *FILE) -> size_t;
@ -933,11 +933,11 @@ mod funcs {
fn lseek(fd: c_int, offset: c_long, origin: c_int) -> c_long;
#[link_name = "_pipe"]
fn pipe(fds: *mutable c_int, psize: c_uint,
fn pipe(fds: *mut c_int, psize: c_uint,
textmode: c_int) -> c_int;
#[link_name = "_read"]
fn read(fd: c_int, buf: *mutable c_void, count: c_uint) -> c_int;
fn read(fd: c_int, buf: *mut c_void, count: c_uint) -> c_int;
#[link_name = "_rmdir"]
fn rmdir(path: *c_char) -> c_int;
@ -1013,7 +1013,7 @@ mod funcs {
fn getegid() -> gid_t;
fn geteuid() -> uid_t;
fn getgid() -> gid_t ;
fn getgroups(ngroups_max: c_int, groups: *mutable gid_t) -> c_int;
fn getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int;
fn getlogin() -> *c_char;
fn getopt(argc: c_int, argv: **c_char, optstr: *c_char) -> c_int;
fn getpgrp() -> pid_t;
@ -1025,8 +1025,8 @@ mod funcs {
fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
fn pathconf(path: *c_char, name: c_int) -> c_long;
fn pause() -> c_int;
fn pipe(fds: *mutable c_int) -> c_int;
fn read(fd: c_int, buf: *mutable c_void,
fn pipe(fds: *mut c_int) -> c_int;
fn read(fd: c_int, buf: *mut c_void,
count: size_t) -> ssize_t;
fn rmdir(path: *c_char) -> c_int;
fn setgid(gid: gid_t) -> c_int;
@ -1050,7 +1050,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
native mod unistd {
fn readlink(path: *c_char, buf: *mutable c_char,
fn readlink(path: *c_char, buf: *mut c_char,
bufsz: size_t) -> ssize_t;
fn fsync(fd: c_int) -> c_int;
@ -1067,7 +1067,7 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
native mod wait {
fn waitpid(pid: pid_t, status: *mutable c_int,
fn waitpid(pid: pid_t, status: *mut c_int,
options: c_int) -> pid_t;
}
}
@ -1096,15 +1096,15 @@ mod funcs {
native mod bsd44 {
fn sysctl(name: *c_int, namelen: c_uint,
oldp: *mutable c_void, oldlenp: *mutable size_t,
oldp: *mut c_void, oldlenp: *mut size_t,
newp: *c_void, newlen: size_t) -> c_int;
fn sysctlbyname(name: *c_char,
oldp: *mutable c_void, oldlenp: *mutable size_t,
oldp: *mut c_void, oldlenp: *mut size_t,
newp: *c_void, newlen: size_t) -> c_int;
fn sysctlnametomib(name: *c_char, mibp: *mutable c_int,
sizep: *mutable size_t) -> c_int;
fn sysctlnametomib(name: *c_char, mibp: *mut c_int,
sizep: *mut size_t) -> c_int;
}
@ -1118,8 +1118,8 @@ mod funcs {
#[nolink]
#[abi = "cdecl"]
native mod extra {
fn _NSGetExecutablePath(buf: *mutable c_char,
bufsize: *mutable u32) -> c_int;
fn _NSGetExecutablePath(buf: *mut c_char,
bufsize: *mut u32) -> c_int;
}
#[cfg(target_os = "freebsd")]

View file

@ -109,10 +109,10 @@ fn test_unwrap_str() {
#[test]
fn test_unwrap_resource() {
resource r(i: @mutable int) {
resource r(i: @mut int) {
*i += 1;
}
let i = @mutable 0;
let i = @mut 0;
{
let x = r(i);
let opt = some(x);

View file

@ -61,7 +61,7 @@ fn as_c_charp<T>(s: str, f: fn(*c_char) -> T) -> T {
str::as_c_str(s) {|b| f(b as *c_char) }
}
fn fill_charp_buf(f: fn(*mutable c_char, size_t) -> bool)
fn fill_charp_buf(f: fn(*mut c_char, size_t) -> bool)
-> option<str> {
let buf = vec::to_mut(vec::from_elem(tmpbuf_sz, 0u8 as c_char));
vec::as_mut_buf(buf) { |b|
@ -77,7 +77,7 @@ fn fill_charp_buf(f: fn(*mutable c_char, size_t) -> bool)
mod win32 {
import dword = libc::types::os::arch::extra::DWORD;
fn fill_utf16_buf_and_decode(f: fn(*mutable u16, dword) -> dword)
fn fill_utf16_buf_and_decode(f: fn(*mut u16, dword) -> dword)
-> option<str> {
// FIXME: remove these when export globs work properly.
@ -241,8 +241,8 @@ fn waitpid(pid: pid_t) -> c_int {
#[cfg(target_os = "freebsd")]
#[cfg(target_os = "macos")]
fn pipe() -> {in: c_int, out: c_int} {
let fds = {mutable in: 0 as c_int,
mutable out: 0 as c_int };
let fds = {mut in: 0 as c_int,
mut out: 0 as c_int };
assert (libc::pipe(ptr::mut_addr_of(fds.in)) == (0 as c_int));
ret {in: fds.in, out: fds.out};
}
@ -258,8 +258,8 @@ fn pipe() -> {in: c_int, out: c_int} {
// understand. Here we explicitly make the pipe non-inheritable, which
// means to pass it to a subprocess they need to be duplicated first, as
// in rust_run_program.
let fds = { mutable in: 0 as c_int,
mutable out: 0 as c_int };
let fds = { mut in: 0 as c_int,
mut out: 0 as c_int };
let res = libc::pipe(ptr::mut_addr_of(fds.in),
1024 as c_uint,
(O_BINARY | O_NOINHERIT) as c_int);
@ -294,7 +294,7 @@ fn self_exe_path() -> option<path> {
KERN_PROC as c_int,
KERN_PROC_PATHNAME as c_int, -1 as c_int];
sysctl(vec::unsafe::to_ptr(mib), vec::len(mib) as c_uint,
buf as *mutable c_void, ptr::mut_addr_of(sz),
buf as *mut c_void, ptr::mut_addr_of(sz),
ptr::null(), 0u as size_t) == (0 as c_int)
}
}

View file

@ -28,9 +28,9 @@ native mod rusti {
#[inline(always)]
fn addr_of<T>(val: T) -> *T { rusti::addr_of(val) }
#[doc = "Get an unsafe mutable pointer to a value"]
#[doc = "Get an unsafe mut pointer to a value"]
#[inline(always)]
fn mut_addr_of<T>(val: T) -> *mutable T unsafe {
fn mut_addr_of<T>(val: T) -> *mut T unsafe {
unsafe::reinterpret_cast(rusti::addr_of(val))
}
@ -40,10 +40,10 @@ fn offset<T>(ptr: *T, count: uint) -> *T unsafe {
(ptr as uint + count * sys::size_of::<T>()) as *T
}
#[doc = "Calculate the offset from a mutable pointer"]
#[doc = "Calculate the offset from a mut pointer"]
#[inline(always)]
fn mut_offset<T>(ptr: *mutable T, count: uint) -> *mutable T {
(ptr as uint + count * sys::size_of::<T>()) as *mutable T
fn mut_offset<T>(ptr: *mut T, count: uint) -> *mut T {
(ptr as uint + count * sys::size_of::<T>()) as *mut T
}
@ -77,16 +77,16 @@ unsafe fn memmove<T>(dst: *T, src: *T, count: uint) {
#[test]
fn test() unsafe {
type pair = {mutable fst: int, mutable snd: int};
let p = {mutable fst: 10, mutable snd: 20};
let pptr: *mutable pair = mut_addr_of(p);
let iptr: *mutable int = unsafe::reinterpret_cast(pptr);
type pair = {mut fst: int, mut snd: int};
let p = {mut fst: 10, mut snd: 20};
let pptr: *mut pair = mut_addr_of(p);
let iptr: *mut int = unsafe::reinterpret_cast(pptr);
assert (*iptr == 10);;
*iptr = 30;
assert (*iptr == 30);
assert (p.fst == 30);;
*pptr = {mutable fst: 50, mutable snd: 60};
*pptr = {mut fst: 50, mut snd: 60};
assert (*iptr == 50);
assert (p.fst == 50);
assert (p.snd == 60);

View file

@ -198,10 +198,10 @@ fn start_program(prog: str, args: [str]) -> program {
libc::close(pipe_err.out);
type prog_repr = {pid: pid_t,
mutable in_fd: c_int,
mut in_fd: c_int,
out_file: *libc::FILE,
err_file: *libc::FILE,
mutable finished: bool};
mut finished: bool};
fn close_repr_input(r: prog_repr) {
let invalid_fd = -1i32;
@ -233,10 +233,10 @@ fn start_program(prog: str, args: [str]) -> program {
fn destroy() { destroy_repr(*self); }
}
let repr = {pid: pid,
mutable in_fd: pipe_input.out,
mut in_fd: pipe_input.out,
out_file: os::fdopen(pipe_output.in),
err_file: os::fdopen(pipe_err.in),
mutable finished: false};
mut finished: false};
ret prog_res(repr) as program;
}

View file

@ -157,8 +157,8 @@ Provides detailed control over the properties and behavior of new tasks.
// the run function move them in.
enum task_builder {
task_builder_({
mutable opts: task_opts,
mutable gen_body: fn@(+fn~()) -> fn~(),
mut opts: task_opts,
mut gen_body: fn@(+fn~()) -> fn~(),
can_not_copy: option<comm::port<()>>
})
}
@ -187,8 +187,8 @@ fn task_builder() -> task_builder {
let body_identity = fn@(+body: fn~()) -> fn~() { body };
task_builder_({
mutable opts: default_task_opts(),
mutable gen_body: body_identity,
mut opts: default_task_opts(),
mut gen_body: body_identity,
can_not_copy: none
})
}

View file

@ -150,15 +150,15 @@ fn from_elem<T: copy>(n_elts: uint, t: T) -> [T] {
ret v;
}
#[doc = "Produces a mutable vector from an immutable vector."]
fn to_mut<T>(+v: [T]) -> [mutable T] unsafe {
#[doc = "Produces a mut vector from an immutable vector."]
fn to_mut<T>(+v: [T]) -> [mut T] unsafe {
let r = ::unsafe::reinterpret_cast(v);
::unsafe::forget(v);
r
}
#[doc = "Produces an immutable vector from a mutable vector."]
fn from_mut<T>(+v: [mutable T]) -> [T] unsafe {
#[doc = "Produces an immutable vector from a mut vector."]
fn from_mut<T>(+v: [mut T]) -> [T] unsafe {
let r = ::unsafe::reinterpret_cast(v);
::unsafe::forget(v);
r
@ -396,7 +396,7 @@ Sets the element at position `index` to `val`. If `index` is past the end
of the vector, expands the vector by replicating `initval` to fill the
intervening space.
"]
fn grow_set<T: copy>(&v: [mutable T], index: uint, initval: T, val: T) {
fn grow_set<T: copy>(&v: [mut T], index: uint, initval: T, val: T) {
if index >= len(v) { grow(v, index - len(v) + 1u, initval); }
v[index] = val;
}
@ -729,12 +729,12 @@ Swaps two elements in a vector
* a - The index of the first element
* b - The index of the second element
"]
fn swap<T>(v: [mutable T], a: uint, b: uint) {
fn swap<T>(v: [mut T], a: uint, b: uint) {
v[a] <-> v[b];
}
#[doc = "Reverse the order of elements in a vector, in place"]
fn reverse<T>(v: [mutable T]) {
fn reverse<T>(v: [mut T]) {
let mut i: uint = 0u;
let ln = len::<T>(v);
while i < ln / 2u { v[i] <-> v[ln - i - 1u]; i += 1u; }
@ -890,8 +890,8 @@ fn as_buf<E,T>(v: [const E], f: fn(*E) -> T) -> T unsafe {
let buf = unsafe::to_ptr(v); f(buf)
}
fn as_mut_buf<E,T>(v: [mutable E], f: fn(*mutable E) -> T) -> T unsafe {
let buf = unsafe::to_ptr(v) as *mutable E; f(buf)
fn as_mut_buf<E,T>(v: [mut E], f: fn(*mut E) -> T) -> T unsafe {
let buf = unsafe::to_ptr(v) as *mut E; f(buf)
}
#[doc = "An extension implementation providing a `len` method"]
@ -905,7 +905,7 @@ impl vec_len<T> for [const T] {
mod unsafe {
// FIXME: This should have crate visibility
#[doc = "The internal representation of a vector"]
type vec_repr = {mutable fill: uint, mutable alloc: uint, data: u8};
type vec_repr = {mut fill: uint, mut alloc: uint, data: u8};
#[doc = "
Constructs a vector from an unsafe pointer to a buffer
@ -1212,7 +1212,7 @@ mod tests {
#[test]
fn test_grow_set() {
let mut v = [mutable 1, 2, 3];
let mut v = [mut 1, 2, 3];
grow_set(v, 4u, 4, 5);
assert (len(v) == 5u);
assert (v[0] == 1);
@ -1619,7 +1619,7 @@ mod tests {
#[test]
fn reverse_and_reversed() {
let v: [mutable int] = [mutable 10, 20];
let v: [mut int] = [mut 10, 20];
assert (v[0] == 10);
assert (v[1] == 20);
reverse(v);
@ -1634,13 +1634,13 @@ mod tests {
let v4 = reversed::<int>([]);
assert (v4 == []);
let v3: [mutable int] = [mutable];
let v3: [mut int] = [mut];
reverse::<int>(v3);
}
#[test]
fn reversed_mut() {
let v2 = reversed::<int>([mutable 10, 20]);
let v2 = reversed::<int>([mut 10, 20]);
assert (v2[0] == 20);
assert (v2[1] == 10);
}

View file

@ -22,7 +22,7 @@ export eq_vec;
// for the case where nbits <= 32.
#[doc = "The bitvector type"]
type bitv = @{storage: [mutable uint], nbits: uint};
type bitv = @{storage: [mut uint], nbits: uint};
const uint_bits: uint = 32u + (1u << 32u >> 27u);

View file

@ -4,7 +4,7 @@ Library to interface with chunks of memory allocated in C.
It is often desirable to safely interface with memory allocated from C,
encapsulating the unsafety into allocation and destruction time. Indeed,
allocating memory externally is currently the only way to give Rust shared
mutable state with C programs that keep their own references; vectors are
mut state with C programs that keep their own references; vectors are
unsuitable because they could be reallocated or moved at any time, and
importing C memory into a vector takes a one-time snapshot of the memory.
@ -38,7 +38,7 @@ Wrapped in a enum for opacity; FIXME #818 when it is possible to have
truly opaque types, this should be revisited.
"]
enum c_vec<T> {
c_vec_({ base: *mutable T, len: uint, rsrc: @dtor_res})
c_vec_({ base: *mut T, len: uint, rsrc: @dtor_res})
}
resource dtor_res(dtor: option<fn@()>) {
@ -60,7 +60,7 @@ Create a `c_vec` from a native buffer with a given length.
* base - A native pointer to a buffer
* len - The number of elements in the buffer
"]
unsafe fn c_vec<T>(base: *mutable T, len: uint) -> c_vec<T> {
unsafe fn c_vec<T>(base: *mut T, len: uint) -> c_vec<T> {
ret c_vec_({
base: base,
len: len,
@ -79,7 +79,7 @@ and a function to run upon destruction.
* dtor - A function to run when the value is destructed, useful
for freeing the buffer, etc.
"]
unsafe fn c_vec_with_dtor<T>(base: *mutable T, len: uint, dtor: fn@())
unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: fn@())
-> c_vec<T> {
ret c_vec_({
base: base,
@ -122,7 +122,7 @@ fn len<T>(t: c_vec<T>) -> uint {
}
#[doc = "Returns a pointer to the first element of the vector"]
unsafe fn ptr<T>(t: c_vec<T>) -> *mutable T {
unsafe fn ptr<T>(t: c_vec<T>) -> *mut T {
ret (*t).base;
}
@ -135,7 +135,7 @@ mod tests {
assert mem as int != 0;
ret unsafe { c_vec_with_dtor(mem as *mutable u8, n,
ret unsafe { c_vec_with_dtor(mem as *mut u8, n,
bind free(mem)) };
}

View file

@ -23,30 +23,30 @@ fn create<T: copy>() -> t<T> {
* Grow is only called on full elts, so nelts is also len(elts), unlike
* elsewhere.
*/
fn grow<T: copy>(nelts: uint, lo: uint, elts: [mutable cell<T>]) ->
[mutable cell<T>] {
fn grow<T: copy>(nelts: uint, lo: uint, elts: [mut cell<T>]) ->
[mut cell<T>] {
assert (nelts == vec::len(elts));
let mut rv = [mutable];
let mut rv = [mut];
let mut i = 0u;
let nalloc = uint::next_power_of_two(nelts + 1u);
while i < nalloc {
if i < nelts {
rv += [mutable elts[(lo + i) % nelts]];
} else { rv += [mutable none]; }
rv += [mut elts[(lo + i) % nelts]];
} else { rv += [mut none]; }
i += 1u;
}
ret rv;
}
fn get<T: copy>(elts: [mutable cell<T>], i: uint) -> T {
fn get<T: copy>(elts: [mut cell<T>], i: uint) -> T {
ret alt elts[i] { some(t) { t } _ { fail } };
}
type repr<T> = {mutable nelts: uint,
mutable lo: uint,
mutable hi: uint,
mutable elts: [mutable cell<T>]};
type repr<T> = {mut nelts: uint,
mut lo: uint,
mut hi: uint,
mut elts: [mut cell<T>]};
impl <T: copy> of t<T> for repr<T> {
fn size() -> uint { ret self.nelts; }
@ -102,10 +102,10 @@ fn create<T: copy>() -> t<T> {
}
let repr: repr<T> = {
mutable nelts: 0u,
mutable lo: 0u,
mutable hi: 0u,
mutable elts: vec::to_mut(vec::from_elem(initial_capacity, none))
mut nelts: 0u,
mut lo: 0u,
mut hi: 0u,
mut elts: vec::to_mut(vec::from_elem(initial_capacity, none))
};
repr as t::<T>
}

View file

@ -149,7 +149,7 @@ fn doc_as_i32(d: doc) -> i32 { doc_as_u32(d) as i32 }
fn doc_as_i64(d: doc) -> i64 { doc_as_u64(d) as i64 }
// ebml writing
type writer = {writer: io::writer, mutable size_positions: [uint]};
type writer = {writer: io::writer, mut size_positions: [uint]};
fn write_sized_vuint(w: io::writer, n: uint, size: uint) {
let buf: [u8] = alt size {
@ -178,7 +178,7 @@ fn write_vuint(w: io::writer, n: uint) {
fn writer(w: io::writer) -> writer {
let size_positions: [uint] = [];
ret {writer: w, mutable size_positions: size_positions};
ret {writer: w, mut size_positions: size_positions};
}
// TODO: Provide a function to write the standard ebml header.
@ -361,11 +361,11 @@ impl serializer of serialization::serializer for ebml::writer {
fn emit_tup_elt(_idx: uint, f: fn()) { f() }
}
type ebml_deserializer = {mutable parent: ebml::doc,
mutable pos: uint};
type ebml_deserializer = {mut parent: ebml::doc,
mut pos: uint};
fn ebml_deserializer(d: ebml::doc) -> ebml_deserializer {
{mutable parent: d, mutable pos: d.start}
{mut parent: d, mut pos: d.start}
}
impl deserializer of serialization::deserializer for ebml_deserializer {

View file

@ -114,7 +114,7 @@ enum optval { val(str), given, }
The result of checking command line arguments. Contains a vector
of matches and a vector of free strings.
"]
type match = {opts: [opt], vals: [mutable [optval]], free: [str]};
type match = {opts: [opt], vals: [mut [optval]], free: [str]};
fn is_arg(arg: str) -> bool {
ret str::len(arg) > 1u && arg[0] == '-' as u8;

View file

@ -109,9 +109,9 @@ fn to_str(j: json) -> str {
type parser = {
rdr: io::reader,
mutable ch: char,
mutable line: uint,
mutable col: uint,
mut ch: char,
mut line: uint,
mut col: uint,
};
impl parser for parser {
@ -458,9 +458,9 @@ impl parser for parser {
fn from_reader(rdr: io::reader) -> result<json, error> {
let parser = {
rdr: rdr,
mutable ch: rdr.read_char(),
mutable line: 1u,
mutable col: 1u,
mut ch: rdr.read_char(),
mut line: 1u,
mut col: 1u,
};
parser.parse()

View file

@ -164,7 +164,7 @@ mod tests {
#[test]
fn test_from_vec_mut() {
let l = from_vec([mutable 0, 1, 2]);
let l = from_vec([mut 0, 1, 2]);
assert (head(l) == 0);

View file

@ -71,8 +71,8 @@ mod chained {
type entry<K, V> = {
hash: uint,
key: K,
mutable value: V,
mutable next: chain<K, V>
mut value: V,
mut next: chain<K, V>
};
enum chain<K, V> {
@ -81,8 +81,8 @@ mod chained {
}
type t<K, V> = @{
mutable count: uint,
mutable chains: [mutable chain<K,V>],
mut count: uint,
mut chains: [mut chain<K,V>],
hasher: hashfn<K>,
eqer: eqfn<K>
};
@ -152,8 +152,8 @@ mod chained {
tbl.chains[idx] = present(@{
hash: hash,
key: k,
mutable value: v,
mutable next: old_chain});
mut value: v,
mut next: old_chain});
ret true;
}
found_first(_, entry) {
@ -203,7 +203,7 @@ mod chained {
}
}
fn chains<K: copy, V: copy>(nchains: uint) -> [mutable chain<K,V>] {
fn chains<K: copy, V: copy>(nchains: uint) -> [mut chain<K,V>] {
ret vec::to_mut(vec::from_elem(nchains, absent));
}
@ -286,8 +286,8 @@ mod chained {
fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> t<K,V> {
let initial_capacity: uint = 32u; // 2^5
let slf: t<K, V> = @{mutable count: 0u,
mutable chains: chains(initial_capacity),
let slf: t<K, V> = @{mut count: 0u,
mut chains: chains(initial_capacity),
hasher: hasher,
eqer: eqer};
slf

View file

@ -154,7 +154,7 @@ rope remains balanced. However, this function does not take any further
measure to ensure that the result is balanced.
"]
fn concat(v: [rope]) -> rope {
//Copy `v` into a mutable vector
//Copy `v` into a mut vector
let mut len = vec::len(v);
if len == 0u { ret node::empty; }
let ropes = vec::to_mut(vec::from_elem(len, v[0]));
@ -752,7 +752,7 @@ mod node {
* forest - The forest. This vector is progressively rewritten during
execution and should be discarded as meaningless afterwards.
"]
fn tree_from_forest_destructive(forest: [mutable @node]) -> @node {
fn tree_from_forest_destructive(forest: [mut @node]) -> @node {
let mut i = 0u;
let mut len = vec::len(forest);
while len > 1u {
@ -861,12 +861,12 @@ mod node {
fn bal(node: @node) -> option<@node> {
if height(node) < hint_max_node_height { ret option::none; }
//1. Gather all leaves as a forest
let mut forest = [mutable];
let mut forest = [mut];
let it = leaf_iterator::start(node);
loop {
alt (leaf_iterator::next(it)) {
option::none { break; }
option::some(x) { forest += [mutable @leaf(x)]; }
option::some(x) { forest += [mut @leaf(x)]; }
}
}
//2. Rebuild tree from forest
@ -1117,20 +1117,20 @@ mod node {
mod leaf_iterator {
type t = {
stack: [mutable @node],
mutable stackpos: int
stack: [mut @node],
mut stackpos: int
};
fn empty() -> t {
let stack : [mutable @node] = [mutable];
ret {stack: stack, mutable stackpos: -1}
let stack : [mut @node] = [mut];
ret {stack: stack, mut stackpos: -1}
}
fn start(node: @node) -> t {
let stack = vec::to_mut(vec::from_elem(height(node)+1u, node));
ret {
stack: stack,
mutable stackpos: 0
mut stackpos: 0
}
}
@ -1157,23 +1157,23 @@ mod node {
mod char_iterator {
type t = {
leaf_iterator: leaf_iterator::t,
mutable leaf: option<leaf>,
mutable leaf_byte_pos: uint
mut leaf: option<leaf>,
mut leaf_byte_pos: uint
};
fn start(node: @node) -> t {
ret {
leaf_iterator: leaf_iterator::start(node),
mutable leaf: option::none,
mutable leaf_byte_pos: 0u
mut leaf: option::none,
mut leaf_byte_pos: 0u
}
}
fn empty() -> t {
ret {
leaf_iterator: leaf_iterator::empty(),
mutable leaf: option::none,
mutable leaf_byte_pos: 0u
mut leaf: option::none,
mut leaf_byte_pos: 0u
}
}
@ -1242,8 +1242,8 @@ mod tests {
alt(r) {
node::empty { ret "" }
node::content(x) {
let str = @mutable "";
fn aux(str: @mutable str, node: @node::node) unsafe {
let str = @mut "";
fn aux(str: @mut str, node: @node::node) unsafe {
alt(*node) {
node::leaf(x) {
*str += str::slice(
@ -1280,7 +1280,7 @@ mod tests {
#[test]
fn of_string2() {
let buf = @ mutable "1234567890";
let buf = @ mut "1234567890";
let mut i = 0;
while i < 10 { *buf = *buf + *buf; i+=1;}
let sample = @*buf;
@ -1313,7 +1313,7 @@ mod tests {
#[test]
fn iter1() {
let buf = @ mutable "1234567890";
let buf = @ mut "1234567890";
let mut i = 0;
while i < 10 { *buf = *buf + *buf; i+=1;}
let sample = @*buf;
@ -1334,7 +1334,7 @@ mod tests {
#[test]
fn bal1() {
let init = @ "1234567890";
let buf = @ mutable * init;
let buf = @ mut * init;
let mut i = 0;
while i < 8 { *buf = *buf + *buf; i+=1;}
let sample = @*buf;

View file

@ -52,13 +52,13 @@ const k3: u32 = 0xCA62C1D6u32;
#[doc = "Construct a `sha` object"]
fn sha1() -> sha1 {
type sha1state =
{h: [mutable u32],
mutable len_low: u32,
mutable len_high: u32,
msg_block: [mutable u8],
mutable msg_block_idx: uint,
mutable computed: bool,
work_buf: [mutable u32]};
{h: [mut u32],
mut len_low: u32,
mut len_high: u32,
msg_block: [mut u8],
mut msg_block_idx: uint,
mut computed: bool,
work_buf: [mut u32]};
fn add_input(st: sha1state, msg: [u8]) {
// FIXME: Should be typestate precondition
@ -244,11 +244,11 @@ fn sha1() -> sha1 {
}
let st = {
h: vec::to_mut(vec::from_elem(digest_buf_len, 0u32)),
mutable len_low: 0u32,
mutable len_high: 0u32,
mut len_low: 0u32,
mut len_high: 0u32,
msg_block: vec::to_mut(vec::from_elem(msg_block_len, 0u8)),
mutable msg_block_idx: 0u,
mutable computed: false,
mut msg_block_idx: 0u,
mut computed: false,
work_buf: vec::to_mut(vec::from_elem(work_buf_len, 0u32))
};
let sh = st as sha1;

View file

@ -7,12 +7,12 @@ import core::option::{some, none};
// FIXME: Should not be @; there's a bug somewhere in rustc that requires this
// to be.
type smallintmap<T: copy> = @{mutable v: [mutable option<T>]};
type smallintmap<T: copy> = @{mut v: [mut option<T>]};
#[doc = "Create a smallintmap"]
fn mk<T: copy>() -> smallintmap<T> {
let v: [mutable option<T>] = [mutable];
ret @{mutable v: v};
let v: [mut option<T>] = [mut];
ret @{mut v: v};
}
#[doc = "

View file

@ -51,7 +51,7 @@ fn merge_sort<T: copy>(le: le<T>, v: [const T]) -> [T] {
}
}
fn part<T: copy>(compare_func: le<T>, arr: [mutable T], left: uint,
fn part<T: copy>(compare_func: le<T>, arr: [mut T], left: uint,
right: uint, pivot: uint) -> uint {
let pivot_value = arr[pivot];
arr[pivot] <-> arr[right];
@ -68,7 +68,7 @@ fn part<T: copy>(compare_func: le<T>, arr: [mutable T], left: uint,
ret storage_index;
}
fn qsort<T: copy>(compare_func: le<T>, arr: [mutable T], left: uint,
fn qsort<T: copy>(compare_func: le<T>, arr: [mut T], left: uint,
right: uint) {
if right > left {
let pivot = (left + right) / 2u;
@ -82,18 +82,18 @@ fn qsort<T: copy>(compare_func: le<T>, arr: [mutable T], left: uint,
}
#[doc = "
Quicksort. Sorts a mutable vector in place.
Quicksort. Sorts a mut vector in place.
Has worst case O(n^2) performance, average case O(n log n).
This is an unstable sort.
"]
fn quick_sort<T: copy>(compare_func: le<T>, arr: [mutable T]) {
fn quick_sort<T: copy>(compare_func: le<T>, arr: [mut T]) {
if len::<T>(arr) == 0u { ret; }
qsort::<T>(compare_func, arr, 0u, len::<T>(arr) - 1u);
}
fn qsort3<T: copy>(compare_func_lt: le<T>, compare_func_eq: le<T>,
arr: [mutable T], left: int, right: int) {
arr: [mut T], left: int, right: int) {
if right <= left { ret; }
let v: T = arr[right];
let mut i: int = left - 1;
@ -142,7 +142,7 @@ fn qsort3<T: copy>(compare_func_lt: le<T>, compare_func_eq: le<T>,
// FIXME: This should take lt and eq types
#[doc = "
Fancy quicksort. Sorts a mutable vector in place.
Fancy quicksort. Sorts a mut vector in place.
Based on algorithm presented by [Sedgewick and Bentley]
(http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf).
@ -152,7 +152,7 @@ According to these slides this is the algorithm of choice for
This is an unstable sort.
"]
fn quick_sort3<T: copy>(compare_func_lt: le<T>, compare_func_eq: le<T>,
arr: [mutable T]) {
arr: [mut T]) {
if len::<T>(arr) == 0u { ret; }
qsort3::<T>(compare_func_lt, compare_func_eq, arr, 0,
(len::<T>(arr) as int) - 1);
@ -160,7 +160,7 @@ fn quick_sort3<T: copy>(compare_func_lt: le<T>, compare_func_eq: le<T>,
#[cfg(test)]
mod test_qsort3 {
fn check_sort(v1: [mutable int], v2: [mutable int]) {
fn check_sort(v1: [mut int], v2: [mut int]) {
let len = vec::len::<int>(v1);
fn lt(&&a: int, &&b: int) -> bool { ret a < b; }
fn equal(&&a: int, &&b: int) -> bool { ret a == b; }
@ -178,24 +178,24 @@ mod test_qsort3 {
#[test]
fn test() {
{
let v1 = [mutable 3, 7, 4, 5, 2, 9, 5, 8];
let v2 = [mutable 2, 3, 4, 5, 5, 7, 8, 9];
let v1 = [mut 3, 7, 4, 5, 2, 9, 5, 8];
let v2 = [mut 2, 3, 4, 5, 5, 7, 8, 9];
check_sort(v1, v2);
}
{
let v1 = [mutable 1, 1, 1];
let v2 = [mutable 1, 1, 1];
let v1 = [mut 1, 1, 1];
let v2 = [mut 1, 1, 1];
check_sort(v1, v2);
}
{
let v1: [mutable int] = [mutable];
let v2: [mutable int] = [mutable];
let v1: [mut int] = [mut];
let v2: [mut int] = [mut];
check_sort(v1, v2);
}
{ let v1 = [mutable 9]; let v2 = [mutable 9]; check_sort(v1, v2); }
{ let v1 = [mut 9]; let v2 = [mut 9]; check_sort(v1, v2); }
{
let v1 = [mutable 9, 3, 3, 3, 9];
let v2 = [mutable 3, 3, 3, 9, 9];
let v1 = [mut 9, 3, 3, 3, 9];
let v2 = [mut 3, 3, 3, 9, 9];
check_sort(v1, v2);
}
}
@ -203,7 +203,7 @@ mod test_qsort3 {
#[cfg(test)]
mod test_qsort {
fn check_sort(v1: [mutable int], v2: [mutable int]) {
fn check_sort(v1: [mut int], v2: [mut int]) {
let len = vec::len::<int>(v1);
fn leual(&&a: int, &&b: int) -> bool { ret a <= b; }
let f = leual;
@ -219,24 +219,24 @@ mod test_qsort {
#[test]
fn test() {
{
let v1 = [mutable 3, 7, 4, 5, 2, 9, 5, 8];
let v2 = [mutable 2, 3, 4, 5, 5, 7, 8, 9];
let v1 = [mut 3, 7, 4, 5, 2, 9, 5, 8];
let v2 = [mut 2, 3, 4, 5, 5, 7, 8, 9];
check_sort(v1, v2);
}
{
let v1 = [mutable 1, 1, 1];
let v2 = [mutable 1, 1, 1];
let v1 = [mut 1, 1, 1];
let v2 = [mut 1, 1, 1];
check_sort(v1, v2);
}
{
let v1: [mutable int] = [mutable];
let v2: [mutable int] = [mutable];
let v1: [mut int] = [mut];
let v2: [mut int] = [mut];
check_sort(v1, v2);
}
{ let v1 = [mutable 9]; let v2 = [mutable 9]; check_sort(v1, v2); }
{ let v1 = [mut 9]; let v2 = [mut 9]; check_sort(v1, v2); }
{
let v1 = [mutable 9, 3, 3, 3, 9];
let v2 = [mutable 3, 3, 3, 9, 9];
let v1 = [mut 9, 3, 3, 3, 9];
let v2 = [mut 3, 3, 3, 9, 9];
check_sort(v1, v2);
}
}
@ -244,7 +244,7 @@ mod test_qsort {
// Regression test for #750
#[test]
fn test_simple() {
let names = [mutable 2, 1, 3];
let names = [mut 2, 1, 3];
let expected = [1, 2, 3];
@ -294,7 +294,7 @@ mod tests {
#[test]
fn test_merge_sort_mutable() {
fn le(&&a: int, &&b: int) -> bool { ret a <= b; }
let v1 = [mutable 3, 2, 1];
let v1 = [mut 3, 2, 1];
let v2 = merge_sort(le, v1);
assert v2 == [1, 2, 3];
}

View file

@ -88,11 +88,11 @@ enum test_result { tr_ok, tr_failed, tr_ignored, }
type console_test_state =
@{out: io::writer,
use_color: bool,
mutable total: uint,
mutable passed: uint,
mutable failed: uint,
mutable ignored: uint,
mutable failures: [test_desc]};
mut total: uint,
mut passed: uint,
mut failed: uint,
mut ignored: uint,
mut failures: [test_desc]};
// A simple console test runner
fn run_tests_console(opts: test_opts,
@ -131,11 +131,11 @@ fn run_tests_console(opts: test_opts,
let st =
@{out: io::stdout(),
use_color: use_color(),
mutable total: 0u,
mutable passed: 0u,
mutable failed: 0u,
mutable ignored: 0u,
mutable failures: []};
mut total: 0u,
mut passed: 0u,
mut failed: 0u,
mut ignored: 0u,
mut failures: []};
run_tests(opts, tests, bind callback(_, st));
@ -210,11 +210,11 @@ fn should_sort_failures_before_printing_them() {
let st =
@{out: writer,
use_color: false,
mutable total: 0u,
mutable passed: 0u,
mutable failed: 0u,
mutable ignored: 0u,
mutable failures: [test_b, test_a]};
mut total: 0u,
mut passed: 0u,
mut failed: 0u,
mut ignored: 0u,
mut failures: [test_b, test_a]};
print_failures(st);

View file

@ -15,17 +15,17 @@ export insert;
export find;
export traverse;
type treemap<K, V> = @mutable tree_node<K, V>;
type treemap<K, V> = @mut tree_node<K, V>;
enum tree_node<K, V> { empty, node(@K, @V, treemap<K, V>, treemap<K, V>) }
#[doc = "Create a treemap"]
fn treemap<K, V>() -> treemap<K, V> { @mutable empty }
fn treemap<K, V>() -> treemap<K, V> { @mut empty }
#[doc = "Insert a value into the map"]
fn insert<K: copy, V: copy>(m: treemap<K, V>, k: K, v: V) {
alt m {
@empty { *m = node(@k, @v, @mutable empty, @mutable empty); }
@empty { *m = node(@k, @v, @mut empty, @mut empty); }
@node(@kk, _, _, _) {
// We have to name left and right individually, because
@ -114,8 +114,8 @@ mod tests {
insert(m, 2, ());
insert(m, 1, ());
let n = @mutable 0;
fn t(n: @mutable int, &&k: int, &&_v: ()) {
let n = @mut 0;
fn t(n: @mut int, &&k: int, &&_v: ()) {
assert (*n == k); *n += 1;
}
traverse(m, bind t(n, _, _));

View file

@ -8,13 +8,13 @@ import option::{some, none};
// than the node itself.
type node = option<uint>;
type ufind = {mutable nodes: [mutable node]};
type ufind = {mut nodes: [mut node]};
fn make() -> ufind { ret {mutable nodes: [mutable]}; }
fn make() -> ufind { ret {mut nodes: [mut]}; }
fn make_set(ufnd: ufind) -> uint {
let idx = vec::len(ufnd.nodes);
ufnd.nodes += [mutable none::<uint>];
ufnd.nodes += [mut none::<uint>];
ret idx;
}

View file

@ -37,7 +37,7 @@ iface handler {
}
type handler_t = @{
mutable err_count: uint,
mut err_count: uint,
_emit: emitter
};
@ -127,7 +127,7 @@ fn mk_handler(emitter: option<emitter>) -> handler {
};
@{
mutable err_count: 0u,
mut err_count: 0u,
_emit: emit
} as handler
}

View file

@ -479,17 +479,17 @@ fn build_session_(
cstore: cstore,
parse_sess: @{
cm: codemap,
mutable next_id: 1,
mut next_id: 1,
span_diagnostic: span_diagnostic_handler,
mutable chpos: 0u,
mutable byte_pos: 0u
mut chpos: 0u,
mut byte_pos: 0u
},
codemap: codemap,
// For a library crate, this is always none
mutable main_fn: none,
mut main_fn: none,
span_diagnostic: span_diagnostic_handler,
filesearch: filesearch,
mutable building_library: false,
mut building_library: false,
working_dir: os::getcwd()}
}

View file

@ -56,10 +56,10 @@ type session = @{targ_cfg: @config,
parse_sess: parse_sess,
codemap: codemap::codemap,
// For a library crate, this is always none
mutable main_fn: option<(node_id, codemap::span)>,
mut main_fn: option<(node_id, codemap::span)>,
span_diagnostic: diagnostic::span_handler,
filesearch: filesearch::filesearch,
mutable building_library: bool,
mut building_library: bool,
working_dir: str};
impl session for session {

View file

@ -198,8 +198,8 @@ fn sort_meta_items(items: [@ast::meta_item]) -> [@ast::meta_item] {
}
// This is sort of stupid here, converting to a vec of mutables and back
let mut v: [mutable @ast::meta_item] = [mutable];
for mi: @ast::meta_item in items { v += [mutable mi]; }
let mut v: [mut @ast::meta_item] = [mut];
for mi: @ast::meta_item in items { v += [mut mi]; }
std::sort::quick_sort(lteq, v);

View file

@ -19,8 +19,8 @@ type test = {span: span, path: [ast::ident], ignore: bool, should_fail: bool};
type test_ctxt =
@{sess: session::session,
crate: @ast::crate,
mutable path: [ast::ident],
mutable testfns: [test]};
mut path: [ast::ident],
mut testfns: [test]};
// Traverse the crate, collecting all the test functions, eliding any
// existing main functions, and synthesizing a main test harness
@ -39,8 +39,8 @@ fn generate_test_harness(sess: session::session,
let cx: test_ctxt =
@{sess: sess,
crate: crate,
mutable path: [],
mutable testfns: []};
mut path: [],
mut testfns: []};
let precursor =
{fold_crate: fold::wrap(bind fold_crate(cx, _, _)),

View file

@ -234,8 +234,8 @@ fn visit_ids(item: ast::inlined_item, vfn: fn@(ast::node_id)) {
}
fn compute_id_range(item: ast::inlined_item) -> id_range {
let min = @mutable int::max_value;
let max = @mutable int::min_value;
let min = @mut int::max_value;
let max = @mut int::min_value;
visit_ids(item) {|id|
*min = int::min(*min, id);
*max = int::max(*max, id + 1);
@ -684,7 +684,7 @@ fn encode_side_tables_for_ii(ecx: @e::encode_ctxt,
ebml_w.wr_tag(c::tag_table as uint) {||
visit_ids(ii, fn@(id: ast::node_id) {
// Note: this will cause a copy of ebml_w, which is bad as
// it has mutable fields. But I believe it's harmless since
// it has mut fields. But I believe it's harmless since
// we generate balanced EBML.
encode_side_tables_for_id(ecx, ebml_w, id)
});
@ -943,10 +943,10 @@ fn new_parse_sess() -> parser::parse_sess {
let handler = diagnostic::mk_handler(option::none);
let sess = @{
cm: cm,
mutable next_id: 1,
mut next_id: 1,
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
mutable chpos: 0u,
mutable byte_pos: 0u
mut chpos: 0u,
mut byte_pos: 0u
};
ret sess;
}

View file

@ -21,7 +21,7 @@ export list_file_metadata;
fn read_crates(sess: session::session, crate: ast::crate) {
let e = @{sess: sess,
crate_cache: std::map::str_hash::<int>(),
mutable next_crate_num: 1};
mut next_crate_num: 1};
let v =
visit::mk_simple_visitor(@{visit_view_item:
bind visit_view_item(e, _),
@ -32,7 +32,7 @@ fn read_crates(sess: session::session, crate: ast::crate) {
type env = @{sess: session::session,
crate_cache: hashmap<str, int>,
mutable next_crate_num: ast::crate_num};
mut next_crate_num: ast::crate_num};
fn visit_view_item(e: env, i: @ast::view_item) {
alt i.node {

View file

@ -53,9 +53,9 @@ type cstore_private =
@{metas: map::hashmap<ast::crate_num, crate_metadata>,
use_crate_map: use_crate_map,
mod_path_map: mod_path_map,
mutable used_crate_files: [str],
mutable used_libraries: [str],
mutable used_link_args: [str]};
mut used_crate_files: [str],
mut used_libraries: [str],
mut used_link_args: [str]};
// Map from node_id's of local use statements to crate numbers
type use_crate_map = map::hashmap<ast::node_id, ast::crate_num>;
@ -70,9 +70,9 @@ fn mk_cstore() -> cstore {
ret private(@{metas: meta_cache,
use_crate_map: crate_map,
mod_path_map: mod_path_map,
mutable used_crate_files: [],
mutable used_libraries: [],
mutable used_link_args: []});
mut used_crate_files: [],
mut used_libraries: [],
mut used_link_args: []});
}
fn get_crate_data(cstore: cstore, cnum: ast::crate_num) -> crate_metadata {

View file

@ -283,7 +283,7 @@ fn encode_parent_item(ebml_w: ebml::writer, id: def_id) {
fn encode_enum_variant_info(ecx: @encode_ctxt, ebml_w: ebml::writer,
id: node_id, variants: [variant],
path: ast_map::path, index: @mutable [entry<int>],
path: ast_map::path, index: @mut [entry<int>],
ty_params: [ty_param]) {
let mut disr_val = 0;
let mut i = 0;
@ -362,9 +362,9 @@ fn encode_privacy(ebml_w: ebml::writer, privacy: privacy) {
fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
id: node_id, path: ast_map::path,
items: [@class_item],
global_index: @mutable[entry<int>])
global_index: @mut[entry<int>])
-> [entry<int>] {
let index = @mutable [];
let index = @mut [];
let tcx = ecx.ccx.tcx;
for ci in items {
/* We encode both private and public fields -- need to include
@ -466,14 +466,14 @@ fn should_inline(attrs: [attribute]) -> bool {
fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
index: @mutable [entry<int>], path: ast_map::path) {
index: @mut [entry<int>], path: ast_map::path) {
let tcx = ecx.ccx.tcx;
let must_write = alt item.node { item_enum(_, _) { true } _ { false } };
if !must_write && !ecx.ccx.reachable.contains_key(item.id) { ret; }
fn add_to_index_(item: @item, ebml_w: ebml::writer,
index: @mutable [entry<int>]) {
index: @mut [entry<int>]) {
*index += [{val: item.id, pos: ebml_w.writer.tell()}];
}
let add_to_index = bind add_to_index_(item, ebml_w, index);
@ -678,7 +678,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
nitem: @native_item,
index: @mutable [entry<int>],
index: @mut [entry<int>],
path: ast_map::path, abi: native_abi) {
if !ecx.ccx.reachable.contains_key(nitem.id) { ret; }
*index += [{val: nitem.id, pos: ebml_w.writer.tell()}];
@ -704,7 +704,7 @@ fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
crate: @crate) -> [entry<int>] {
let index = @mutable [];
let index = @mut [];
ebml_w.start_tag(tag_items_data);
*index += [{val: crate_node_id, pos: ebml_w.writer.tell()}];
encode_info_for_mod(ecx, ebml_w, crate.node.module,
@ -752,15 +752,15 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
fn create_index<T: copy>(index: [entry<T>], hash_fn: fn@(T) -> uint) ->
[@[entry<T>]] {
let mut buckets: [@mutable [entry<T>]] = [];
uint::range(0u, 256u) {|_i| buckets += [@mutable []]; };
let mut buckets: [@mut [entry<T>]] = [];
uint::range(0u, 256u) {|_i| buckets += [@mut []]; };
for elt: entry<T> in index {
let h = hash_fn(elt.val);
*buckets[h % 256u] += [elt];
}
let mut buckets_frozen = [];
for bucket: @mutable [entry<T>] in buckets {
for bucket: @mut [entry<T>] in buckets {
buckets_frozen += [@*bucket];
}
ret buckets_frozen;
@ -901,9 +901,9 @@ fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) {
type numname = {crate: crate_num, ident: str};
// Pull the cnums and names out of cstore
let mut pairs: [mutable numname] = [mutable];
let mut pairs: [mut numname] = [mut];
cstore::iter_crate_data(cstore) {|key, val|
pairs += [mutable {crate: key, ident: val.name}];
pairs += [mut {crate: key, ident: val.name}];
};
// Sort by cnum
@ -919,7 +919,7 @@ fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) {
// Return just the names
fn name(kv: numname) -> str { kv.ident }
// mutable -> immutable hack for vec::map
// mut -> immutable hack for vec::map
let immpairs = vec::slice(pairs, 0u, vec::len(pairs));
ret vec::map(immpairs, name);
}

View file

@ -17,7 +17,7 @@ export parse_bounds_data;
// Callback to translate defs to strs or back:
type conv_did = fn(ast::def_id) -> ast::def_id;
type pstate = {data: @[u8], crate: int, mutable pos: uint, tcx: ty::ctxt};
type pstate = {data: @[u8], crate: int, mut pos: uint, tcx: ty::ctxt};
fn peek(st: @pstate) -> char {
st.data[st.pos] as char
@ -52,7 +52,7 @@ fn parse_ident_(st: @pstate, is_last: fn@(char) -> bool) ->
fn parse_ty_data(data: @[u8], crate_num: int, pos: uint, tcx: ty::ctxt,
conv: conv_did) -> ty::t {
let st = @{data: data, crate: crate_num, mutable pos: pos, tcx: tcx};
let st = @{data: data, crate: crate_num, mut pos: pos, tcx: tcx};
parse_ty(st, conv)
}
@ -416,7 +416,7 @@ fn parse_def_id(buf: [u8]) -> ast::def_id {
fn parse_bounds_data(data: @[u8], start: uint,
crate_num: int, tcx: ty::ctxt, conv: conv_did)
-> @[ty::param_bound] {
let st = @{data: data, crate: crate_num, mutable pos: start, tcx: tcx};
let st = @{data: data, crate: crate_num, mut pos: start, tcx: tcx};
parse_bounds(st, conv)
}

View file

@ -30,11 +30,11 @@ type binding = @{node_id: node_id,
root_var: option<node_id>,
local_id: uint,
unsafe_tys: [unsafe_ty],
mutable copied: copied};
mut copied: copied};
// FIXME it may be worthwhile to use a linked list of bindings instead
type scope = {bs: [binding],
invalid: @mutable list<@invalid>};
invalid: @mut list<@invalid>};
fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option<node_id>,
unsafe_tys: [unsafe_ty]) -> binding {
@ -45,7 +45,7 @@ fn mk_binding(cx: ctx, id: node_id, span: span, root_var: option<node_id>,
ret @{node_id: id, span: span, root_var: root_var,
local_id: local_id_of_node(cx, id),
unsafe_tys: unsafe_tys,
mutable copied: not_copied};
mut copied: not_copied};
}
enum local_info { local(uint), }
@ -56,7 +56,7 @@ type ref_map = std::map::hashmap<node_id, node_id>;
type ctx = {tcx: ty::ctxt,
copy_map: copy_map,
ref_map: ref_map,
mutable silent: bool};
mut silent: bool};
fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> (copy_map, ref_map) {
// Stores information about function arguments that's otherwise not easily
@ -64,12 +64,12 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> (copy_map, ref_map) {
let cx = @{tcx: tcx,
copy_map: std::map::int_hash(),
ref_map: std::map::int_hash(),
mutable silent: false};
mut silent: false};
let v = @{visit_fn: bind visit_fn(cx, _, _, _, _, _, _, _),
visit_expr: bind visit_expr(cx, _, _, _),
visit_block: bind visit_block(cx, _, _, _)
with *visit::default_visitor::<scope>()};
let sc = {bs: [], invalid: @mutable list::nil};
let sc = {bs: [], invalid: @mut list::nil};
visit::visit_crate(*crate, sc, visit::mk_vt(v));
tcx.sess.abort_if_errors();
ret (cx.copy_map, cx.ref_map);
@ -89,7 +89,7 @@ fn visit_fn(cx: @ctx, _fk: visit::fn_kind, decl: ast::fn_decl,
check_loop(*cx, sc) {|| v.visit_block(body, sc, v);}
}
ast::proto_box | ast::proto_uniq | ast::proto_bare {
let sc = {bs: [], invalid: @mutable list::nil};
let sc = {bs: [], invalid: @mut list::nil};
v.visit_block(body, sc, v);
}
}
@ -242,7 +242,7 @@ fn check_call(cx: ctx, sc: scope, f: @ast::expr, args: [@ast::expr])
root_var: root_var,
local_id: 0u,
unsafe_tys: unsafe_set(root.mutbl),
mutable copied: arg_copied}];
mut copied: arg_copied}];
i += 1u;
}
let f_may_close =
@ -291,7 +291,7 @@ fn check_call(cx: ctx, sc: scope, f: @ast::expr, args: [@ast::expr])
}
j += 1u;
}
// Ensure we're not passing a root by mutable alias.
// Ensure we're not passing a root by mut alias.
for {node: node, arg: arg} in mut_roots {
let mut i = 0u;
@ -301,7 +301,7 @@ fn check_call(cx: ctx, sc: scope, f: @ast::expr, args: [@ast::expr])
some(root) {
if node == root && cant_copy(cx, b) {
err(cx, args[arg].span,
"passing a mutable reference to a \
"passing a mut reference to a \
variable that roots another reference");
break;
}
@ -327,7 +327,7 @@ fn check_alt(cx: ctx, input: @ast::expr, arms: [ast::arm], sc: scope,
let pat_id_map = pat_util::pat_id_map(cx.tcx.def_map, a.pats[0]);
type info = {
id: node_id,
mutable unsafe_tys: [unsafe_ty],
mut unsafe_tys: [unsafe_ty],
span: span};
let mut binding_info: [info] = [];
for pat in a.pats {
@ -338,7 +338,7 @@ fn check_alt(cx: ctx, input: @ast::expr, arms: [ast::arm], sc: scope,
none {
binding_info += [
{id: canon_id,
mutable unsafe_tys: unsafe_set(proot.mutbl),
mut unsafe_tys: unsafe_set(proot.mutbl),
span: proot.span}];
}
}
@ -359,7 +359,7 @@ fn check_for(cx: ctx, local: @ast::local, seq: @ast::expr, blk: ast::blk,
sc: scope, v: vt<scope>) {
let root = expr_root(cx, seq, false);
// If this is a mutable vector, don't allow it to be touched.
// If this is a mut vector, don't allow it to be touched.
let seq_t = ty::expr_ty(cx.tcx, seq);
let mut cur_mutbl = root.mutbl;
alt ty::get(seq_t).struct {
@ -522,7 +522,7 @@ fn ty_can_unsafely_include(cx: ctx, needle: unsafe_ty, haystack: ty::t,
ty::ty_fn(_) | ty::ty_iface(_, _) { ret true; }
// A type param may include everything, but can only be
// treated as opaque downstream, and is thus safe unless we
// saw mutable fields, in which case the whole thing can be
// saw mut fields, in which case the whole thing can be
// overwritten.
ty::ty_param(_, _) { ret mutbl; }
_ { ret false; }

View file

@ -40,8 +40,8 @@ enum ast_node {
}
type map = std::map::hashmap<node_id, ast_node>;
type ctx = {map: map, mutable path: path,
mutable local_id: uint, sess: session};
type ctx = {map: map, mut path: path,
mut local_id: uint, sess: session};
type vt = visit::vt<ctx>;
fn extend(cx: ctx, elt: str) -> @path {
@ -63,8 +63,8 @@ fn mk_ast_map_visitor() -> vt {
fn map_crate(sess: session, c: crate) -> map {
let cx = {map: std::map::int_hash(),
mutable path: [],
mutable local_id: 0u,
mut path: [],
mut local_id: 0u,
sess: sess};
visit::visit_crate(c, cx, mk_ast_map_visitor());
ret cx.map;
@ -81,8 +81,8 @@ fn map_decoded_item(sess: session, map: map, path: path, ii: inlined_item) {
// even if we did I think it only needs an ordering between local
// variables that are simultaneously in scope).
let cx = {map: map,
mutable path: path,
mutable local_id: 0u,
mut path: path,
mut local_id: 0u,
sess: sess};
let v = mk_ast_map_visitor();

View file

@ -2,10 +2,10 @@ import syntax::visit;
import syntax::ast::*;
import driver::session::session;
type ctx = {tcx: ty::ctxt, mutable allow_block: bool};
type ctx = {tcx: ty::ctxt, mut allow_block: bool};
fn check_crate(tcx: ty::ctxt, crate: @crate) {
let cx = {tcx: tcx, mutable allow_block: false};
let cx = {tcx: tcx, mut allow_block: false};
let v = visit::mk_vt(@{visit_expr: visit_expr
with *visit::default_visitor()});
visit::visit_crate(*crate, cx, v);

View file

@ -101,8 +101,8 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: [@pat]) {
vec::iter(cols) {|col| check_exhaustive(tcx, sp, col); }
}
ty::ty_rec(fs) {
let cols = vec::from_elem(fs.len(), {mutable wild: false,
mutable pats: []});
let cols = vec::from_elem(fs.len(), {mut wild: false,
mut pats: []});
for p in pats {
alt raw_pat(p).node {
pat_rec(sub, _) {
@ -156,7 +156,7 @@ fn check_exhaustive_enum(tcx: ty::ctxt, enum_id: def_id, sp: span,
pats: [@pat]) {
let variants = enum_variants(tcx, enum_id);
let columns_by_variant = vec::map(*variants, {|v|
{mutable seen: false,
{mut seen: false,
cols: vec::to_mut(vec::from_elem(v.args.len(), []))}
});

View file

@ -34,7 +34,7 @@ type freevar_map = hashmap<ast::node_id, freevar_info>;
fn collect_freevars(def_map: resolve::def_map, blk: ast::blk)
-> freevar_info {
let seen = int_hash();
let refs = @mutable [];
let refs = @mut [];
fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }

View file

@ -424,8 +424,8 @@ impl unify_methods for infer_ctxt {
alt b.mutbl {
ast::m_mutbl {
// If supertype is mutable, subtype must match exactly
// (i.e., invariant if mutable):
// If supertype is mut, subtype must match exactly
// (i.e., invariant if mut):
self.eq_tys(a.ty, b.ty)
}
ast::m_imm | ast::m_const {
@ -751,7 +751,7 @@ impl resolve_methods for infer_ctxt {
}
}
fn subst_vars(unresolved: @mutable option<int>,
fn subst_vars(unresolved: @mut option<int>,
vars_seen: std::list::list<int>,
vid: int) -> ty::t {
// Should really return a fixup_result instead of a t, but fold_ty
@ -785,7 +785,7 @@ impl resolve_methods for infer_ctxt {
}
fn fixup_vars(typ: ty::t) -> fres<ty::t> {
let unresolved = @mutable none::<int>;
let unresolved = @mut none::<int>;
let rty =
ty::fold_ty(self.tcx,
ty::fm_var(
@ -802,7 +802,7 @@ impl resolve_methods for infer_ctxt {
}
}
fn subst_regions(unresolved: @mutable option<int>,
fn subst_regions(unresolved: @mut option<int>,
regions_seen: std::list::list<int>,
rid: int) -> ty::region {
// Should really return a fixup_result instead of a t, but fold_ty
@ -826,7 +826,7 @@ impl resolve_methods for infer_ctxt {
}
fn fixup_regions(typ: ty::t) -> fres<ty::t> {
let unresolved = @mutable none::<int>;
let unresolved = @mut none::<int>;
let rty = ty::fold_ty(self.tcx, ty::fm_rptr({ |region, _under_rptr|
alt region {
ty::re_var(rid) {
@ -1346,8 +1346,8 @@ impl of combine for glb {
mt_to_str(tcx, b));
alt (a.mutbl, b.mutbl) {
// If one side or both is mutable, then the GLB must use
// the precise type from the mutable side.
// If one side or both is mut, then the GLB must use
// the precise type from the mut side.
(ast::m_mutbl, ast::m_const) {
self.infcx().tys(a.ty, b.ty).then {||
ok({ty: a.ty, mutbl: ast::m_mutbl})

View file

@ -38,7 +38,7 @@ enum block_type { func, lp, }
enum use { var_use(node_id), close_over(node_id), }
type set = [{def: node_id, uses: list<use>}];
type bl = @{type: block_type, mutable second: bool, mutable exits: [set]};
type bl = @{type: block_type, mut second: bool, mut exits: [set]};
enum use_id { path(node_id), close(node_id, node_id) }
fn hash_use_id(id: use_id) -> uint {
@ -51,8 +51,8 @@ type ctx = {last_uses: std::map::hashmap<use_id, bool>,
ref_map: alias::ref_map,
tcx: ty::ctxt,
// The current set of local last uses
mutable current: set,
mutable blocks: list<bl>};
mut current: set,
mut blocks: list<bl>};
fn find_last_uses(c: @crate, def_map: resolve::def_map,
ref_map: alias::ref_map, tcx: ty::ctxt)
@ -66,8 +66,8 @@ fn find_last_uses(c: @crate, def_map: resolve::def_map,
def_map: def_map,
ref_map: ref_map,
tcx: tcx,
mutable current: [],
mutable blocks: nil};
mut current: [],
mut blocks: nil};
visit::visit_crate(*c, cx, v);
let mini_table = std::map::int_hash();
cx.last_uses.items {|key, val|
@ -268,7 +268,7 @@ fn visit_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
}
fn visit_block(tp: block_type, cx: ctx, visit: fn()) {
let local = @{type: tp, mutable second: false, mutable exits: []};
let local = @{type: tp, mut second: false, mut exits: []};
cx.blocks = cons(local, @cx.blocks);
visit();
local.second = true;

View file

@ -131,7 +131,7 @@ 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_mutbl_ref { "passing " + name + " by mutable reference" }
msg_mutbl_ref { "passing " + name + " by mut reference" }
});
}
@ -254,7 +254,7 @@ fn check_bind(cx: @ctx, f: @expr, args: [option<@expr>]) {
alt arg {
some(expr) {
let o_msg = alt ty::resolved_mode(cx.tcx, arg_ts[i].mode) {
by_mutbl_ref { some("by mutable reference") }
by_mutbl_ref { some("by mut reference") }
by_move { some("by move") }
_ { none }
};

View file

@ -35,7 +35,7 @@ enum scope {
scope_fn_expr(ast::fn_decl, node_id, [ast::ty_param]),
scope_native_item(@ast::native_item),
scope_loop(@ast::local), // there's only 1 decl per loop.
scope_block(ast::blk, @mutable uint, @mutable uint),
scope_block(ast::blk, @mut uint, @mut uint),
scope_arm(ast::arm),
scope_method(node_id, [ast::ty_param]),
}
@ -104,8 +104,8 @@ type glob_imp_def = {def: def, path: @ast::view_path};
type indexed_mod = {
m: option<ast::_mod>,
index: mod_index,
mutable glob_imports: [glob_imp_def],
mutable globbed_exports: [ident],
mut glob_imports: [glob_imp_def],
mut globbed_exports: [ident],
glob_imported_names: hashmap<str, glob_import_state>,
path: str
};
@ -127,19 +127,19 @@ type env =
def_map: def_map,
ast_map: ast_map::map,
imports: hashmap<node_id, import_state>,
mutable exp_map: exp_map,
mut exp_map: exp_map,
mod_map: hashmap<node_id, @indexed_mod>,
block_map: hashmap<node_id, [glob_imp_def]>,
ext_map: ext_map,
impl_map: impl_map,
impl_cache: impl_cache,
ext_cache: ext_hash,
used_imports: {mutable track: bool,
mutable data: [node_id]},
mutable reported: [{ident: str, sc: scope}],
mutable ignored_imports: [node_id],
mutable current_tp: option<uint>,
mutable resolve_unexported: bool,
used_imports: {mut track: bool,
mut data: [node_id]},
mut reported: [{ident: str, sc: scope}],
mut ignored_imports: [node_id],
mut current_tp: option<uint>,
mut resolve_unexported: bool,
sess: session};
@ -171,18 +171,18 @@ fn create_env(sess: session, amap: ast_map::map) -> @env {
def_map: int_hash(),
ast_map: amap,
imports: int_hash(),
mutable exp_map: int_hash(),
mut exp_map: int_hash(),
mod_map: int_hash(),
block_map: int_hash(),
ext_map: new_def_hash(),
impl_map: int_hash(),
impl_cache: new_def_hash(),
ext_cache: new_ext_hash(),
used_imports: {mutable track: false, mutable data: []},
mutable reported: [],
mutable ignored_imports: [],
mutable current_tp: none,
mutable resolve_unexported: false,
used_imports: {mut track: false, mut data: []},
mut reported: [],
mut ignored_imports: [],
mut current_tp: none,
mut resolve_unexported: false,
sess: sess}
}
@ -268,8 +268,8 @@ fn map_crate(e: @env, c: @ast::crate) {
e.mod_map.insert(i.id,
@{m: some(md),
index: index_mod(md),
mutable glob_imports: [],
mutable globbed_exports: [],
mut glob_imports: [],
mut globbed_exports: [],
glob_imported_names: str_hash(),
path: path_from_scope(sc, i.ident)});
}
@ -277,8 +277,8 @@ fn map_crate(e: @env, c: @ast::crate) {
e.mod_map.insert(i.id,
@{m: none::<ast::_mod>,
index: index_nmod(nmd),
mutable glob_imports: [],
mutable globbed_exports: [],
mut glob_imports: [],
mut globbed_exports: [],
glob_imported_names: str_hash(),
path: path_from_scope(sc, i.ident)});
}
@ -336,8 +336,8 @@ fn map_crate(e: @env, c: @ast::crate) {
e.mod_map.insert(ast::crate_node_id,
@{m: some(c.node.module),
index: index_mod(c.node.module),
mutable glob_imports: [],
mutable globbed_exports: [],
mut glob_imports: [],
mut globbed_exports: [],
glob_imported_names: str_hash(),
path: ""});
@ -580,7 +580,7 @@ fn visit_fn_with_scope(e: @env, fk: visit::fn_kind, decl: ast::fn_decl,
}
fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {
let pos = @mutable 0u, loc = @mutable 0u;
let pos = @mut 0u, loc = @mut 0u;
let block_sc = cons(scope_block(b, pos, loc), @sc);
for vi in b.node.view_items { v.visit_view_item(vi, block_sc, v); }
for stmt in b.node.stmts {
@ -594,7 +594,7 @@ fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {
fn visit_decl_with_scope(d: @decl, sc: scopes, v: vt<scopes>) {
let loc_pos = alt list::head(sc) {
scope_block(_, _, pos) { pos }
_ { @mutable 0u }
_ { @mut 0u }
};
alt d.node {
decl_local(locs) {
@ -1894,11 +1894,11 @@ fn check_ty(e: @env, ty: @ast::ty, &&x: (), v: vt<()>) {
visit::visit_ty(ty, x, v);
}
type checker = @{mutable seen: [ident], kind: str, sess: session};
type checker = @{mut seen: [ident], kind: str, sess: session};
fn checker(e: env, kind: str) -> checker {
let seen: [ident] = [];
ret @{mutable seen: seen, kind: kind, sess: e.sess};
ret @{mut seen: seen, kind: kind, sess: e.sess};
}
fn check_name(ch: checker, sp: span, name: ident) {

View file

@ -640,9 +640,9 @@ fn trans_alt_inner(scope_cx: block, expr: @ast::expr, arms: [ast::arm],
let mk_fail = alt mode {
ast::alt_check {
// Cached fail-on-fallthrough block
let fail_cx = @mutable none;
let fail_cx = @mut none;
fn mk_fail(bcx: block, sp: span,
done: @mutable option<BasicBlockRef>) -> BasicBlockRef {
done: @mut option<BasicBlockRef>) -> BasicBlockRef {
alt *done { some(bb) { ret bb; } _ { } }
let fail_cx = sub_block(bcx, "case_fallthrough");
trans_fail(fail_cx, some(sp), "non-exhaustive match failure");;

View file

@ -56,7 +56,7 @@ import std::smallintmap;
// destination of a computation's value.
enum dest {
by_val(@mutable ValueRef),
by_val(@mut ValueRef),
save_in(ValueRef),
ignore,
}
@ -69,8 +69,8 @@ fn dest_str(ccx: @crate_ctxt, d: dest) -> str {
}
}
fn empty_dest_cell() -> @mutable ValueRef {
ret @mutable llvm::LLVMGetUndef(T_nil());
fn empty_dest_cell() -> @mut ValueRef {
ret @mut llvm::LLVMGetUndef(T_nil());
}
fn dup_for_join(dest: dest) -> dest {
@ -454,9 +454,9 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t) -> @tydesc_info {
tydesc: gvar,
size: llsize,
align: llalign,
mutable take_glue: none,
mutable drop_glue: none,
mutable free_glue: none};
mut take_glue: none,
mut drop_glue: none,
mut free_glue: none};
log(debug, "--- declare_tydesc " + ty_to_str(ccx.tcx, t));
ret info;
}
@ -3516,11 +3516,11 @@ fn new_block(cx: fn_ctxt, parent: block_parent, kind: block_kind,
llvm::LLVMAppendBasicBlock(cx.llfn, buf)
});
let bcx = @{llbb: llbb,
mutable terminated: false,
mutable unreachable: false,
mut terminated: false,
mut unreachable: false,
parent: parent,
kind: kind,
mutable block_span: block_span,
mut block_span: block_span,
fcx: cx};
alt parent {
parent_some(cx) {
@ -3532,8 +3532,8 @@ fn new_block(cx: fn_ctxt, parent: block_parent, kind: block_kind,
}
fn simple_block_scope() -> block_kind {
block_scope({is_loop: none, mutable cleanups: [],
mutable cleanup_paths: [], mutable landing_pad: none})
block_scope({is_loop: none, mut cleanups: [],
mut cleanup_paths: [], mut landing_pad: none})
}
// Use this when you're at the top block of a function or the like.
@ -3552,9 +3552,9 @@ fn loop_scope_block(bcx: block, _cont: loop_cont,
-> block {
ret new_block(bcx.fcx, parent_some(bcx), block_scope({
is_loop: some({cnt: _cont, brk: _break}),
mutable cleanups: [],
mutable cleanup_paths: [],
mutable landing_pad: none
mut cleanups: [],
mut cleanup_paths: [],
mut landing_pad: none
}), n, some(sp));
}
@ -3566,11 +3566,11 @@ fn sub_block(bcx: block, n: str) -> block {
fn raw_block(fcx: fn_ctxt, llbb: BasicBlockRef) -> block {
ret @{llbb: llbb,
mutable terminated: false,
mutable unreachable: false,
mut terminated: false,
mut unreachable: false,
parent: parent_none,
kind: block_non_scope,
mutable block_span: none,
mut block_span: none,
fcx: fcx};
}
@ -3775,11 +3775,11 @@ fn new_fn_ctxt_w_id(ccx: @crate_ctxt, path: path,
ret @{llfn: llfndecl,
llenv: llvm::LLVMGetParam(llfndecl, 1u as c_uint),
llretptr: llvm::LLVMGetParam(llfndecl, 0u as c_uint),
mutable llstaticallocas: llbbs.sa,
mutable llloadenv: llbbs.ca,
mutable llreturn: llbbs.rt,
mutable llself: none,
mutable personality: none,
mut llstaticallocas: llbbs.sa,
mut llloadenv: llbbs.ca,
mut llreturn: llbbs.rt,
mut llself: none,
mut personality: none,
llargs: int_hash::<local_val>(),
lllocals: int_hash::<local_val>(),
llupvars: int_hash::<ValueRef>(),
@ -4766,7 +4766,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
exp_map: emap,
reachable: reachable,
item_symbols: int_hash::<str>(),
mutable main_fn: none::<ValueRef>,
mut main_fn: none::<ValueRef>,
link_meta: link_meta,
enum_sizes: ty::new_ty_hash(),
discrims: ast_util::new_def_id_hash::<ValueRef>(),
@ -4786,13 +4786,13 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
tcx: tcx,
maps: maps,
stats:
{mutable n_static_tydescs: 0u,
mutable n_glues_created: 0u,
mutable n_null_glues: 0u,
mutable n_real_glues: 0u,
llvm_insn_ctxt: @mutable [],
{mut n_static_tydescs: 0u,
mut n_glues_created: 0u,
mut n_null_glues: 0u,
mut n_real_glues: 0u,
llvm_insn_ctxt: @mut [],
llvm_insns: str_hash(),
fn_times: @mutable []},
fn_times: @mut []},
upcalls:
upcall::declare_upcalls(targ_cfg, tn, tydesc_type,
llmod),
@ -4806,7 +4806,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
crate_map: crate_map,
dbg_cx: dbg_cx,
class_ctors: int_hash::<int>(),
mutable do_not_commit_warning_issued: false};
mut do_not_commit_warning_issued: false};
{

View file

@ -22,7 +22,7 @@ import ast_map::path;
type namegen = fn@(str) -> str;
fn new_namegen() -> namegen {
let i = @mutable 0;
let i = @mut 0;
ret fn@(prefix: str) -> str { *i += 1; prefix + int::str(*i) };
}
@ -31,9 +31,9 @@ type tydesc_info =
tydesc: ValueRef,
size: ValueRef,
align: ValueRef,
mutable take_glue: option<ValueRef>,
mutable drop_glue: option<ValueRef>,
mutable free_glue: option<ValueRef>};
mut take_glue: option<ValueRef>,
mut drop_glue: option<ValueRef>,
mut free_glue: option<ValueRef>};
/*
* A note on nomenclature of linking: "upcall", "extern" and "native".
@ -52,13 +52,13 @@ type tydesc_info =
*/
type stats =
{mutable n_static_tydescs: uint,
mutable n_glues_created: uint,
mutable n_null_glues: uint,
mutable n_real_glues: uint,
llvm_insn_ctxt: @mutable [str],
{mut n_static_tydescs: uint,
mut n_glues_created: uint,
mut n_null_glues: uint,
mut n_real_glues: uint,
llvm_insn_ctxt: @mut [str],
llvm_insns: hashmap<str, uint>,
fn_times: @mutable [{ident: str, time: int}]};
fn_times: @mut [{ident: str, time: int}]};
resource BuilderRef_res(B: BuilderRef) { llvm::LLVMDisposeBuilder(B); }
@ -85,7 +85,7 @@ type crate_ctxt = {
exp_map: resolve::exp_map,
reachable: reachable::map,
item_symbols: hashmap<ast::node_id, str>,
mutable main_fn: option<ValueRef>,
mut main_fn: option<ValueRef>,
link_meta: link::link_meta,
enum_sizes: hashmap<ty::t, uint>,
discrims: hashmap<ast::def_id, ValueRef>,
@ -122,7 +122,7 @@ type crate_ctxt = {
// Mapping from class constructors to parent class --
// used in base::trans_closure
class_ctors: hashmap<ast::node_id, ast::node_id>,
mutable do_not_commit_warning_issued: bool};
mut do_not_commit_warning_issued: bool};
// Types used for llself.
type val_self_pair = {v: ValueRef, t: ty::t};
@ -152,19 +152,19 @@ type fn_ctxt = @{
// the function, due to LLVM's quirks.
// A block for all the function's static allocas, so that LLVM
// will coalesce them into a single alloca call.
mutable llstaticallocas: BasicBlockRef,
mut llstaticallocas: BasicBlockRef,
// A block containing code that copies incoming arguments to space
// already allocated by code in one of the llallocas blocks.
// (LLVM requires that arguments be copied to local allocas before
// allowing most any operation to be performed on them.)
mutable llloadenv: BasicBlockRef,
mutable llreturn: BasicBlockRef,
mut llloadenv: BasicBlockRef,
mut llreturn: BasicBlockRef,
// The 'self' value currently in use in this function, if there
// is one.
mutable llself: option<val_self_pair>,
mut llself: option<val_self_pair>,
// The a value alloca'd for calls to upcalls.rust_personality. Used when
// outputting the resume instruction.
mutable personality: option<ValueRef>,
mut personality: option<ValueRef>,
// Maps arguments to allocas created for them in llallocas.
llargs: hashmap<ast::node_id, local_val>,
@ -294,12 +294,12 @@ type scope_info = {
// A list of functions that must be run at when leaving this
// block, cleaning up any variables that were introduced in the
// block.
mutable cleanups: [cleanup],
mut cleanups: [cleanup],
// Existing cleanup paths that may be reused, indexed by destination and
// cleared when the set of cleanups changes.
mutable cleanup_paths: [cleanup_path],
mut cleanup_paths: [cleanup_path],
// Unwinding landing pad. Also cleared when cleanups change.
mutable landing_pad: option<BasicBlockRef>,
mut landing_pad: option<BasicBlockRef>,
};
// Basic block context. We create a block context for each basic block
@ -314,14 +314,14 @@ type block = @{
// instructions into that block by way of this block context.
// The block pointing to this one in the function's digraph.
llbb: BasicBlockRef,
mutable terminated: bool,
mutable unreachable: bool,
mut terminated: bool,
mut unreachable: bool,
parent: block_parent,
// The 'kind' of basic block this is.
kind: block_kind,
// The source span where the block came from, if it is a block that
// actually appears in the source code.
mutable block_span: option<span>,
mut block_span: option<span>,
// The function context for the function to which this block is
// attached.
fcx: fn_ctxt

View file

@ -366,8 +366,8 @@ type struct_ctxt = {
file: ValueRef,
name: str,
line: int,
mutable members: [ValueRef],
mutable total_size: int,
mut members: [ValueRef],
mut total_size: int,
align: int
};
@ -382,8 +382,8 @@ fn create_structure(file: @metadata<file_md>, name: str, line: int)
let cx = @{file: file.node,
name: name,
line: line,
mutable members: [],
mutable total_size: 0,
mut members: [],
mut total_size: 0,
align: 64 //XXX different alignment per arch?
};
ret cx;

View file

@ -23,10 +23,10 @@ import ty_ctxt = middle::ty::ctxt;
type res_info = {did: ast::def_id, tps: [ty::t]};
type ctxt =
{mutable next_tag_id: u16,
{mut next_tag_id: u16,
pad: u16,
tag_id_to_index: hashmap<ast::def_id, u16>,
mutable tag_order: [ast::def_id],
mut tag_order: [ast::def_id],
resources: interner::interner<res_info>,
llshapetablesty: TypeRef,
llshapetables: ValueRef};
@ -126,8 +126,8 @@ fn largest_variants(ccx: @crate_ctxt, tag_id: ast::def_id) -> [uint] {
}
// Initialize the candidate set to contain all variants.
let mut candidates = [mutable];
for variant in *variants { candidates += [mutable true]; }
let mut candidates = [mut];
for variant in *variants { candidates += [mut true]; }
// Do a pairwise comparison among all variants still in the candidate set.
// Throw out any variant that we know has size and alignment at least as
@ -269,10 +269,10 @@ fn mk_ctxt(llmod: ModuleRef) -> ctxt {
lib::llvm::llvm::LLVMAddGlobal(llmod, llshapetablesty, buf)
});
ret {mutable next_tag_id: 0u16,
ret {mut next_tag_id: 0u16,
pad: 0u16,
tag_id_to_index: common::new_def_hash(),
mutable tag_order: [],
mut tag_order: [],
resources: interner::mk(hash_res_info, {|a, b| a == b}),
llshapetablesty: llshapetablesty,
llshapetables: llshapetables};

View file

@ -29,7 +29,7 @@ const use_repr: uint = 1u; // Dependency on size/alignment and take/drop glue
const use_tydesc: uint = 2u; // Takes the tydesc, or compares
type ctx = {ccx: @crate_ctxt,
uses: [mutable type_uses]};
uses: [mut type_uses]};
fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
-> [type_uses] {

View file

@ -7,11 +7,11 @@ import aux::{num_constraints, get_fn_info, crate_ctxt, add_node};
import ann::empty_ann;
import pat_util::pat_binding_ids;
fn collect_ids_expr(e: @expr, rs: @mutable [node_id]) { *rs += [e.id]; }
fn collect_ids_expr(e: @expr, rs: @mut [node_id]) { *rs += [e.id]; }
fn collect_ids_block(b: blk, rs: @mutable [node_id]) { *rs += [b.node.id]; }
fn collect_ids_block(b: blk, rs: @mut [node_id]) { *rs += [b.node.id]; }
fn collect_ids_stmt(s: @stmt, rs: @mutable [node_id]) {
fn collect_ids_stmt(s: @stmt, rs: @mut [node_id]) {
alt s.node {
stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
log(debug, "node_id " + int::str(id));
@ -22,11 +22,11 @@ fn collect_ids_stmt(s: @stmt, rs: @mutable [node_id]) {
}
}
fn collect_ids_local(tcx: ty::ctxt, l: @local, rs: @mutable [node_id]) {
fn collect_ids_local(tcx: ty::ctxt, l: @local, rs: @mut [node_id]) {
*rs += pat_binding_ids(tcx.def_map, l.node.pat);
}
fn node_ids_in_fn(tcx: ty::ctxt, body: blk, rs: @mutable [node_id]) {
fn node_ids_in_fn(tcx: ty::ctxt, body: blk, rs: @mut [node_id]) {
let collect_ids =
visit::mk_simple_visitor(@{visit_expr: bind collect_ids_expr(_, rs),
visit_block: bind collect_ids_block(_, rs),
@ -45,7 +45,7 @@ fn init_vecs(ccx: crate_ctxt, node_ids: [node_id], len: uint) {
}
fn visit_fn(ccx: crate_ctxt, num_constraints: uint, body: blk) {
let node_ids: @mutable [node_id] = @mutable [];
let node_ids: @mut [node_id] = @mut [];
node_ids_in_fn(ccx.tcx, body, node_ids);
let node_id_vec = *node_ids;
init_vecs(ccx, node_id_vec, num_constraints);

View file

@ -200,9 +200,9 @@ type constr_arg_use = spanned<constr_arg_general_<inst>>;
enum constraint {
cinit(uint, span, ident),
// FIXME: really only want it to be mutable during collect_locals.
// FIXME: really only want it to be mut during collect_locals.
// freeze it after that.
cpred(@path, @mutable [pred_args]),
cpred(@path, @mut [pred_args]),
}
// An ninit variant has a node_id because it refers to a local var.
@ -261,7 +261,7 @@ type fn_info =
cf: ret_style,
i_return: tsconstr,
i_diverge: tsconstr,
used_vars: @mutable [node_id]};
used_vars: @mut [node_id]};
fn tsconstr_to_def_id(t: tsconstr) -> def_id {
alt t { ninit(id, _) { local_def(id) } npred(_, id, _) { id } }
@ -275,7 +275,7 @@ fn tsconstr_to_node_id(t: tsconstr) -> node_id {
}
/* mapping from node ID to typestate annotation */
type node_ann_table = @mutable [mutable ts_ann];
type node_ann_table = @mut [mut ts_ann];
/* mapping from function name to fn_info map */
@ -483,8 +483,8 @@ fn pure_exp(ccx: crate_ctxt, id: node_id, p: prestate) -> bool {
fn num_constraints(m: fn_info) -> uint { ret m.num_constraints; }
fn new_crate_ctxt(cx: ty::ctxt) -> crate_ctxt {
let na: [mutable ts_ann] = [mutable];
ret {tcx: cx, node_anns: @mutable na, fm: int_hash::<fn_info>()};
let na: [mut ts_ann] = [mut];
ret {tcx: cx, node_anns: @mut na, fm: int_hash::<fn_info>()};
}
/* Use e's type to determine whether it returns.
@ -549,7 +549,7 @@ fn constraints(fcx: fn_ctxt) -> [norm_constraint] {
// FIXME
// Would rather take an immutable vec as an argument,
// should freeze it at some earlier point.
fn match_args(fcx: fn_ctxt, occs: @mutable [pred_args],
fn match_args(fcx: fn_ctxt, occs: @mut [pred_args],
occ: [@constr_arg_use]) -> uint {
#debug("match_args: looking at %s",
constr_args_to_str(fn@(i: inst) -> str { ret i.ident; }, occ));
@ -995,7 +995,7 @@ fn args_mention<T>(args: [@constr_arg_use],
fn use_var(fcx: fn_ctxt, v: node_id) { *fcx.enclosing.used_vars += [v]; }
// FIXME: This should be a function in vec::.
fn vec_contains(v: @mutable [node_id], i: node_id) -> bool {
fn vec_contains(v: @mut [node_id], i: node_id) -> bool {
for d: node_id in *v { if d == i { ret true; } }
ret false;
}

View file

@ -10,7 +10,7 @@ import driver::session::session;
import aux::*;
import std::map::hashmap;
type ctxt = {cs: @mutable [sp_constr], tcx: ty::ctxt};
type ctxt = {cs: @mut [sp_constr], tcx: ty::ctxt};
fn collect_local(loc: @local, cx: ctxt, v: visit::vt<ctxt>) {
pat_bindings(cx.tcx.def_map, loc.node.pat) {|p_id, _s, id|
@ -46,7 +46,7 @@ fn find_locals(tcx: ty::ctxt,
f_body: blk,
sp: span,
id: node_id) -> ctxt {
let cx: ctxt = {cs: @mutable [], tcx: tcx};
let cx: ctxt = {cs: @mut [], tcx: tcx};
let visitor = visit::default_visitor::<ctxt>();
let visitor =
@{visit_local: collect_local,
@ -78,8 +78,8 @@ fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) ->
}
}
none {
let rslt: @mutable [pred_args] =
@mutable [respan(c.span, {args: args, bit_num: next})];
let rslt: @mut [pred_args] =
@mut [respan(c.span, {args: args, bit_num: next})];
tbl.insert(d_id, cpred(p, rslt));
}
}
@ -141,7 +141,7 @@ fn mk_fn_info(ccx: crate_ctxt,
next = add_constraint(cx.tcx, respan(f_sp, diverges_constr), next,
res_map);
let v: @mutable [node_id] = @mutable [];
let v: @mut [node_id] = @mut [];
let rslt =
{constrs: res_map,
num_constraints: next,

View file

@ -186,7 +186,7 @@ enum borrowing {
type ctxt =
@{interner: hashmap<intern_key, t_box>,
mutable next_id: uint,
mut next_id: uint,
sess: session::session,
def_map: resolve::def_map,
region_map: @middle::region::region_map,
@ -373,7 +373,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map,
option::maybe(k.o_def_id, 0u, ast_util::hash_def_id)
}, {|&&a, &&b| a == b});
@{interner: interner,
mutable next_id: 0u,
mut next_id: 0u,
sess: s,
def_map: dm,
region_map: region_map,
@ -1027,7 +1027,7 @@ fn type_structurally_contains(cx: ctxt, ty: t, test: fn(sty) -> bool) ->
}
// Returns true for noncopyable types and types where a copy of a value can be
// distinguished from the value itself. I.e. types with mutable content that's
// distinguished from the value itself. I.e. types with mut content that's
// not shared through a pointer.
fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
ret !type_structurally_contains(cx, ty, {|sty|
@ -2064,7 +2064,7 @@ fn class_field_tys(items: [@class_item]) -> [field_ty] {
fn class_items_as_fields(cx:ctxt, did: ast::def_id) -> [field] {
let mut rslt = [];
for f in lookup_class_fields(cx, did) {
// consider all instance vars mutable, because the
// consider all instance vars mut, because the
// constructor may mutate all vars
rslt += [{ident: f.ident, mt: {ty: lookup_field_type(cx, did, f.id),
mutbl: m_mutbl}}];

View file

@ -51,7 +51,7 @@ type ty_table = hashmap<ast::def_id, ty::t>;
// Used for typechecking the methods of an impl
enum self_info { self_impl(ty::t) }
type crate_ctxt = {mutable self_infos: [self_info],
type crate_ctxt = {mut self_infos: [self_info],
impl_map: resolve::impl_map,
method_map: method_map,
vtable_map: vtable_map,
@ -75,7 +75,7 @@ type fn_ctxt =
proto: ast::proto,
infcx: infer::infer_ctxt,
locals: hashmap<ast::node_id, int>,
next_var_id: @mutable int,
next_var_id: @mut int,
ccx: @crate_ctxt};
@ -1244,13 +1244,13 @@ mod demand {
ty_param_substs_0: [ty::t]) ->
ty_param_substs_and_ty {
let mut ty_param_substs: [mutable ty::t] = [mutable];
let mut ty_param_substs: [mut ty::t] = [mut];
let mut ty_param_subst_var_ids: [int] = [];
for ty_param_subst: ty::t in ty_param_substs_0 {
// Generate a type variable and unify it with the type parameter
// substitution. We will then pull out these type variables.
let t_0 = next_ty_var(fcx);
ty_param_substs += [mutable t_0];
ty_param_substs += [mut t_0];
ty_param_subst_var_ids += [ty::ty_var_id(t_0)];
simple(fcx, sp, ty_param_subst, t_0);
}
@ -1383,7 +1383,7 @@ mod writeback {
type wb_ctxt =
// As soon as we hit an error we have to stop resolving
// the entire function
{fcx: @fn_ctxt, mutable success: bool};
{fcx: @fn_ctxt, mut success: bool};
type wb_vt = visit::vt<wb_ctxt>;
fn visit_stmt(s: @ast::stmt, wbcx: wb_ctxt, v: wb_vt) {
@ -1461,7 +1461,7 @@ mod writeback {
}
fn resolve_type_vars_in_expr(fcx: @fn_ctxt, e: @ast::expr) -> bool {
let wbcx = {fcx: fcx, mutable success: true};
let wbcx = {fcx: fcx, mut success: true};
let visit =
visit::mk_vt(@{visit_item: visit_item,
visit_stmt: visit_stmt,
@ -1475,7 +1475,7 @@ mod writeback {
}
fn resolve_type_vars_in_block(fcx: @fn_ctxt, blk: ast::blk) -> bool {
let wbcx = {fcx: fcx, mutable success: true};
let wbcx = {fcx: fcx, mut success: true};
let visit =
visit::mk_vt(@{visit_item: visit_item,
visit_stmt: visit_stmt,
@ -1536,7 +1536,7 @@ fn check_intrinsic_type(tcx: ty::ctxt, it: @ast::native_item) {
type gather_result =
{infcx: infer::infer_ctxt,
locals: hashmap<ast::node_id, int>,
next_var_id: @mutable int};
next_var_id: @mut int};
// Used only as a helper for check_fn.
fn gather_locals(ccx: @crate_ctxt,
@ -1548,7 +1548,7 @@ fn gather_locals(ccx: @crate_ctxt,
none {
{infcx: infer::new_infer_ctxt(ccx.tcx),
locals: int_hash::<int>(),
nvi: @mutable 0}
nvi: @mut 0}
}
some(fcx) {
{infcx: fcx.infcx,
@ -2544,7 +2544,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
// const versions of the vectors in L and R. Next, let T be a
// fresh type variable where TL <: T and TR <: T. Then the result
// type is a fresh type variable T1 where T1 <: [const T]. This
// allows the result to be either a mutable or immutable vector,
// allows the result to be either a mut or immutable vector,
// depending on external demands.
let const_vec_t =
ty::mk_vec(tcx, {ty: next_ty_var(fcx),
@ -3370,7 +3370,7 @@ fn check_const(ccx: @crate_ctxt, _sp: span, e: @ast::expr, id: ast::node_id) {
proto: ast::proto_box,
infcx: infer::new_infer_ctxt(ccx.tcx),
locals: int_hash::<int>(),
next_var_id: @mutable 0,
next_var_id: @mut 0,
ccx: ccx};
check_expr(fcx, e);
let cty = expr_ty(fcx.ccx.tcx, e);
@ -3389,7 +3389,7 @@ fn check_enum_variants(ccx: @crate_ctxt, sp: span, vs: [ast::variant],
proto: ast::proto_box,
infcx: infer::new_infer_ctxt(ccx.tcx),
locals: int_hash::<int>(),
next_var_id: @mutable 0,
next_var_id: @mut 0,
ccx: ccx};
let mut disr_vals: [int] = [];
let mut disr_val = 0;
@ -3950,7 +3950,7 @@ fn check_crate(tcx: ty::ctxt, impl_map: resolve::impl_map,
crate: @ast::crate) -> (method_map, vtable_map) {
collect::collect_item_types(tcx, crate);
let ccx = @{mutable self_infos: [],
let ccx = @{mut self_infos: [],
impl_map: impl_map,
method_map: std::map::int_hash(),
vtable_map: std::map::int_hash(),

View file

@ -86,7 +86,7 @@ enum def {
// first def_id is for parent class
def_class_field(def_id, def_id),
// No purity allowed for now, I guess
// (simpler this way, b/c presumably methods read mutable state)
// (simpler this way, b/c presumably methods read mut state)
def_class_method(def_id, def_id),
def_region(node_id)
}

View file

@ -16,13 +16,13 @@ enum file_substr {
type filemap =
@{name: filename, substr: file_substr, src: @str,
start_pos: file_pos, mutable lines: [file_pos]};
start_pos: file_pos, mut lines: [file_pos]};
type codemap = @{mutable files: [filemap]};
type codemap = @{mut files: [filemap]};
type loc = {file: filemap, line: uint, col: uint};
fn new_codemap() -> codemap { @{mutable files: [] } }
fn new_codemap() -> codemap { @{mut files: [] } }
fn new_filemap_w_substr(filename: filename, substr: file_substr,
src: @str,
@ -30,7 +30,7 @@ fn new_filemap_w_substr(filename: filename, substr: file_substr,
-> filemap {
ret @{name: filename, substr: substr, src: src,
start_pos: {ch: start_pos_ch, byte: start_pos_byte},
mutable lines: [{ch: start_pos_ch, byte: start_pos_byte}]};
mut lines: [{ch: start_pos_ch, byte: start_pos_byte}]};
}
fn new_filemap(filename: filename, src: @str,

View file

@ -67,7 +67,7 @@ fn mk_ctxt(session: driver::session::session,
type ctxt_repr = {session: driver::session::session,
parse_sess: parser::parse_sess,
cfg: ast::crate_cfg,
mutable backtrace: expn_info};
mut backtrace: expn_info};
impl of ext_ctxt for ctxt_repr {
fn session() -> driver::session::session { self.session }
fn codemap() -> codemap { self.parse_sess.cm }
@ -122,7 +122,7 @@ fn mk_ctxt(session: driver::session::session,
session: session,
parse_sess: parse_sess,
cfg: cfg,
mutable backtrace: none
mut backtrace: none
};
ret imp as ext_ctxt
}

View file

@ -13,7 +13,7 @@ import io::*;
import codemap::span;
type aq_ctxt = @{lo: uint,
mutable gather: [{lo: uint, hi: uint,
mut gather: [{lo: uint, hi: uint,
e: @ast::expr,
constr: str}]};
enum fragment {
@ -99,7 +99,7 @@ fn gather_anti_quotes<N: qq_helper>(lo: uint, node: N) -> aq_ctxt
let v = @{visit_expr: visit_aq_expr,
visit_ty: visit_aq_ty
with *default_visitor()};
let cx = @{lo:lo, mutable gather: []};
let cx = @{lo:lo, mut gather: []};
node.visit(cx, mk_vt(v));
// FIXME: Maybe this is an overkill (merge_sort), it might be better
// to just keep the gather array in sorted order ...

View file

@ -136,7 +136,7 @@ fn compose_sels(s1: selector, s2: selector) -> selector {
type binders =
{real_binders: hashmap<ident, selector>,
mutable literal_ast_matchers: [selector]};
mut literal_ast_matchers: [selector]};
type bindings = hashmap<ident, arb_depth<matchable>>;
fn acumm_bindings(_cx: ext_ctxt, _b_dest: bindings, _b_src: bindings) { }
@ -148,7 +148,7 @@ fn acumm_bindings(_cx: ext_ctxt, _b_dest: bindings, _b_src: bindings) { }
fn pattern_to_selectors(cx: ext_ctxt, e: @expr) -> binders {
let res: binders =
{real_binders: str_hash::<selector>(),
mutable literal_ast_matchers: []};
mut literal_ast_matchers: []};
//this oughta return binders instead, but macro args are a sequence of
//expressions, rather than a single expression
fn trivial_selector(m: matchable) -> match_result { ret some(leaf(m)); }
@ -183,7 +183,7 @@ fn use_selectors_to_bind(b: binders, e: @expr) -> option<bindings> {
/* use the bindings on the body to generate the expanded code */
fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
let idx_path: @mutable [uint] = @mutable [];
let idx_path: @mut [uint] = @mut [];
fn new_id(_old: node_id, cx: ext_ctxt) -> node_id { ret cx.next_id(); }
fn new_span(cx: ext_ctxt, sp: span) -> span {
/* this discards information in the case of macro-defining macros */
@ -208,7 +208,7 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
/* helper: descend into a matcher */
fn follow(m: arb_depth<matchable>, idx_path: @mutable [uint]) ->
fn follow(m: arb_depth<matchable>, idx_path: @mut [uint]) ->
arb_depth<matchable> {
let mut res: arb_depth<matchable> = m;
for idx: uint in *idx_path {
@ -221,7 +221,7 @@ fn follow(m: arb_depth<matchable>, idx_path: @mutable [uint]) ->
}
fn follow_for_trans(cx: ext_ctxt, mmaybe: option<arb_depth<matchable>>,
idx_path: @mutable [uint]) -> option<matchable> {
idx_path: @mut [uint]) -> option<matchable> {
alt mmaybe {
none { ret none }
some(m) {
@ -258,7 +258,7 @@ fn free_vars(b: bindings, e: @expr, it: fn(ident)) {
/* handle sequences (anywhere in the AST) of exprs, either real or ...ed */
fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
recur: fn@(&&@expr) -> @expr, exprs: [@expr]) -> [@expr] {
alt elts_to_ell(cx, exprs) {
{pre: pre, rep: repeat_me_maybe, post: post} {
@ -320,7 +320,7 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
// substitute, in a position that's required to be an ident
fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
&&i: ident, _fld: ast_fold) -> ident {
ret alt follow_for_trans(cx, b.find(i), idx_path) {
some(match_ident(a_id)) { a_id.node }
@ -330,7 +330,7 @@ fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
}
fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
p: path_, s:span, _fld: ast_fold) -> (path_, span) {
// Don't substitute into qualified names.
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret (p, s); }
@ -345,7 +345,7 @@ fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
}
fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
e: ast::expr_, s: span, fld: ast_fold,
orig: fn@(ast::expr_, span, ast_fold)->(ast::expr_, span))
-> (ast::expr_, span)
@ -373,7 +373,7 @@ fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
}
}
fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
t: ast::ty_, s: span, fld: ast_fold,
orig: fn@(ast::ty_, span, ast_fold) -> (ast::ty_, span))
-> (ast::ty_, span)
@ -399,7 +399,7 @@ fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
/* for parsing reasons, syntax variables bound to blocks must be used like
`{v}` */
fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
blk: blk_, s: span, fld: ast_fold,
orig: fn@(blk_, span, ast_fold) -> (blk_, span))
-> (blk_, span)

View file

@ -15,7 +15,7 @@ export noop_fold_block;
export wrap;
export fold_ty_param;
type ast_fold = @mutable a_f;
type ast_fold = @mut a_f;
// We may eventually want to be able to fold over type parameters, too
@ -602,9 +602,9 @@ fn default_ast_fold() -> @ast_fold_precursor {
fn make_fold(afp: ast_fold_precursor) -> ast_fold {
// FIXME: Have to bind all the bare functions into shared functions
// because @mutable is invariant with respect to its contents
// because @mut is invariant with respect to its contents
let result: ast_fold =
@mutable {fold_crate: bind nf_crate_dummy(_),
@mut {fold_crate: bind nf_crate_dummy(_),
fold_crate_directive: bind nf_crate_directive_dummy(_),
fold_view_item: bind nf_view_item_dummy(_),
fold_native_item: bind nf_native_item_dummy(_),

View file

@ -8,11 +8,11 @@ type reader = @{
span_diagnostic: diagnostic::span_handler,
src: @str,
len: uint,
mutable col: uint,
mutable pos: uint,
mutable curr: char,
mutable chpos: uint,
mutable strs: [str],
mut col: uint,
mut pos: uint,
mut curr: char,
mut chpos: uint,
mut strs: [str],
filemap: codemap::filemap,
interner: @interner::interner<str>
};
@ -63,8 +63,8 @@ fn new_reader(cm: codemap::codemap,
let r = @{cm: cm,
span_diagnostic: span_diagnostic,
src: filemap.src, len: str::len(*filemap.src),
mutable col: 0u, mutable pos: 0u, mutable curr: -1 as char,
mutable chpos: filemap.start_pos.ch, mutable strs: [],
mut col: 0u, mut pos: 0u, mut curr: -1 as char,
mut chpos: filemap.start_pos.ch, mut strs: [],
filemap: filemap, interner: itr};
if r.pos < r.len {
let next = str::char_range_at(*r.src, r.pos);

View file

@ -21,11 +21,11 @@ enum file_type { CRATE_FILE, SOURCE_FILE, }
type parse_sess = @{
cm: codemap::codemap,
mutable next_id: node_id,
mut next_id: node_id,
span_diagnostic: diagnostic::span_handler,
// these two must be kept up to date
mutable chpos: uint,
mutable byte_pos: uint
mut chpos: uint,
mut byte_pos: uint
};
fn next_node_id(sess: parse_sess) -> node_id {
@ -40,11 +40,11 @@ type parser = @{
sess: parse_sess,
cfg: ast::crate_cfg,
file_type: file_type,
mutable token: token::token,
mutable span: span,
mutable last_span: span,
mutable buffer: [{tok: token::token, span: span}],
mutable restriction: restriction,
mut token: token::token,
mut span: span,
mut last_span: span,
mut buffer: [{tok: token::token, span: span}],
mut restriction: restriction,
reader: reader,
precs: @[op_spec],
bad_expr_words: hashmap<str, ()>
@ -130,11 +130,11 @@ fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
@{sess: sess,
cfg: cfg,
file_type: ftype,
mutable token: tok0.tok,
mutable span: span0,
mutable last_span: span0,
mutable buffer: [],
mutable restriction: UNRESTRICTED,
mut token: tok0.tok,
mut span: span0,
mut last_span: span0,
mut buffer: [],
mut restriction: UNRESTRICTED,
reader: rdr,
precs: prec_table(),
bad_expr_words: bad_expr_word_table()}
@ -149,7 +149,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
"class", "const", "cont", "copy", "crust", "do", "else",
"enum", "export", "fail", "fn", "for", "if", "iface",
"impl", "import", "let", "log", "loop", "mod", "mut",
"mutable", "native", "pure", "resource", "ret", "trait",
"mut", "native", "pure", "resource", "ret", "trait",
"type", "unchecked", "unsafe", "while", "new"] {
words.insert(word, ());
}
@ -735,7 +735,7 @@ fn parse_path_and_ty_param_substs(p: parser, colons: bool) -> @ast::path {
}
fn parse_mutability(p: parser) -> ast::mutability {
if eat_word(p, "mutable") {
if eat_word(p, "mut") {
ast::m_mutbl
} else if eat_word(p, "mut") {
ast::m_mutbl
@ -831,7 +831,7 @@ fn parse_bottom_expr(p: parser) -> pexpr {
ret mk_pexpr(p, lo, hi, ast::expr_tup(es));
} else if p.token == token::LBRACE {
p.bump();
if is_word(p, "mut") || is_word(p, "mutable") ||
if is_word(p, "mut") ||
is_plain_ident(p) && p.look_ahead(1u) == token::COLON {
let mut fields = [parse_field(p, token::COLON)];
let mut base = none;
@ -1660,7 +1660,7 @@ fn parse_let(p: parser) -> @ast::decl {
fn parse_instance_var(p:parser) -> (ast::class_member, codemap::span) {
let mut is_mutbl = ast::class_immutable;
let lo = p.span.lo;
if eat_word(p, "mut") || eat_word(p, "mutable") {
if eat_word(p, "mut") {
is_mutbl = ast::class_mutable;
}
if !is_plain_ident(p) {

View file

@ -70,7 +70,7 @@ fn tok_str(t: token) -> str {
}
}
fn buf_str(toks: [mutable token], szs: [mutable int], left: uint, right: uint,
fn buf_str(toks: [mut token], szs: [mut int], left: uint, right: uint,
lim: uint) -> str {
let n = vec::len(toks);
assert (n == vec::len(szs));
@ -99,26 +99,26 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
// fall behind.
let n: uint = 3u * linewidth;
#debug("mk_printer %u", linewidth);
let token: [mutable token] = vec::to_mut(vec::from_elem(n, EOF));
let size: [mutable int] = vec::to_mut(vec::from_elem(n, 0));
let scan_stack: [mutable uint] = vec::to_mut(vec::from_elem(n, 0u));
let token: [mut token] = vec::to_mut(vec::from_elem(n, EOF));
let size: [mut int] = vec::to_mut(vec::from_elem(n, 0));
let scan_stack: [mut uint] = vec::to_mut(vec::from_elem(n, 0u));
let print_stack: [print_stack_elt] = [];
@{out: out,
buf_len: n,
mutable margin: linewidth as int,
mutable space: linewidth as int,
mutable left: 0u,
mutable right: 0u,
mutable token: token,
mutable size: size,
mutable left_total: 0,
mutable right_total: 0,
mutable scan_stack: scan_stack,
mutable scan_stack_empty: true,
mutable top: 0u,
mutable bottom: 0u,
mutable print_stack: print_stack,
mutable pending_indentation: 0}
mut margin: linewidth as int,
mut space: linewidth as int,
mut left: 0u,
mut right: 0u,
mut token: token,
mut size: size,
mut left_total: 0,
mut right_total: 0,
mut scan_stack: scan_stack,
mut scan_stack_empty: true,
mut top: 0u,
mut bottom: 0u,
mut print_stack: print_stack,
mut pending_indentation: 0}
}
@ -202,28 +202,28 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
type printer = @{
out: io::writer,
buf_len: uint,
mutable margin: int, // width of lines we're constrained to
mutable space: int, // number of spaces left on line
mutable left: uint, // index of left side of input stream
mutable right: uint, // index of right side of input stream
mutable token: [mutable token], // ring-buffr stream goes through
mutable size: [mutable int], // ring-buffer of calculated sizes
mutable left_total: int, // running size of stream "...left"
mutable right_total: int, // running size of stream "...right"
mut margin: int, // width of lines we're constrained to
mut space: int, // number of spaces left on line
mut left: uint, // index of left side of input stream
mut right: uint, // index of right side of input stream
mut token: [mut token], // ring-buffr stream goes through
mut size: [mut int], // ring-buffer of calculated sizes
mut left_total: int, // running size of stream "...left"
mut right_total: int, // running size of stream "...right"
// pseudo-stack, really a ring too. Holds the
// primary-ring-buffers index of the BEGIN that started the
// current block, possibly with the most recent BREAK after that
// BEGIN (if there is any) on top of it. Stuff is flushed off the
// bottom as it becomes irrelevant due to the primary ring-buffer
// advancing.
mutable scan_stack: [mutable uint],
mutable scan_stack_empty: bool, // top==bottom disambiguator
mutable top: uint, // index of top of scan_stack
mutable bottom: uint, // index of bottom of scan_stack
mut scan_stack: [mut uint],
mut scan_stack_empty: bool, // top==bottom disambiguator
mut top: uint, // index of top of scan_stack
mut bottom: uint, // index of bottom of scan_stack
// stack of blocks-in-progress being flushed by print
mutable print_stack: [print_stack_elt],
mut print_stack: [print_stack_elt],
// buffered indentation to avoid writing trailing whitespace
mutable pending_indentation: int
mut pending_indentation: int
};
impl printer for printer {

View file

@ -24,9 +24,9 @@ type ps =
cm: option<codemap>,
comments: option<[lexer::cmnt]>,
literals: option<[lexer::lit]>,
mutable cur_cmnt: uint,
mutable cur_lit: uint,
mutable boxes: [pp::breaks],
mut cur_cmnt: uint,
mut cur_lit: uint,
mut boxes: [pp::breaks],
ann: pp_ann};
fn ibox(s: ps, u: uint) { s.boxes += [pp::inconsistent]; pp::ibox(s.s, u); }
@ -39,9 +39,9 @@ fn rust_printer(writer: io::writer) -> ps {
cm: none::<codemap>,
comments: none::<[lexer::cmnt]>,
literals: none::<[lexer::lit]>,
mutable cur_cmnt: 0u,
mutable cur_lit: 0u,
mutable boxes: boxes,
mut cur_cmnt: 0u,
mut cur_lit: 0u,
mut boxes: boxes,
ann: no_ann()};
}
@ -64,9 +64,9 @@ fn print_crate(cm: codemap, span_diagnostic: diagnostic::span_handler,
cm: some(cm),
comments: some(r.cmnts),
literals: some(r.lits),
mutable cur_cmnt: 0u,
mutable cur_lit: 0u,
mutable boxes: boxes,
mut cur_cmnt: 0u,
mut cur_lit: 0u,
mut boxes: boxes,
ann: ann};
print_crate_(s, crate);
}
@ -518,7 +518,7 @@ fn print_item(s: ps, &&item: @ast::item) {
ast::instance_var(nm, t, mt, _) {
word_nbsp(s, "let");
alt mt {
ast::class_mutable { word_nbsp(s, "mutable"); }
ast::class_mutable { word_nbsp(s, "mut"); }
_ {}
}
word(s.s, nm);
@ -818,7 +818,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
ibox(s, indent_unit);
word(s.s, "[");
if mutbl == ast::m_mutbl {
word(s.s, "mutable");
word(s.s, "mut");
if vec::len(exprs) > 0u { nbsp(s); }
}
commasep_exprs(s, inconsistent, exprs);
@ -828,7 +828,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
ast::expr_rec(fields, wth) {
fn print_field(s: ps, field: ast::field) {
ibox(s, indent_unit);
if field.node.mutbl == ast::m_mutbl { word_nbsp(s, "mutable"); }
if field.node.mutbl == ast::m_mutbl { word_nbsp(s, "mut"); }
word(s.s, field.node.ident);
word_space(s, ":");
print_expr(s, field.node.expr);
@ -1135,7 +1135,7 @@ fn print_decl(s: ps, decl: @ast::decl) {
ibox(s, indent_unit);
word_nbsp(s, "let");
// if any are mutable, all are mutable
// if any are mut, all are mut
if vec::any(locs) {|l| l.node.is_mutbl } {
assert vec::all(locs) {|l| l.node.is_mutbl };
word_nbsp(s, "mut");
@ -1493,7 +1493,7 @@ fn print_op_maybe_parens(s: ps, expr: @ast::expr, outer_prec: int) {
fn print_mutability(s: ps, mutbl: ast::mutability) {
alt mutbl {
ast::m_mutbl { word_nbsp(s, "mutable"); }
ast::m_mutbl { word_nbsp(s, "mut"); }
ast::m_const { word_nbsp(s, "const"); }
ast::m_imm {/* nothing */ }
}

View file

@ -6,13 +6,13 @@ import std::map::{hashmap, hashfn, eqfn};
type interner<T> =
{map: hashmap<T, uint>,
mutable vect: [T],
mut vect: [T],
hasher: hashfn<T>,
eqer: eqfn<T>};
fn mk<T: copy>(hasher: hashfn<T>, eqer: eqfn<T>) -> interner<T> {
let m = map::hashmap::<T, uint>(hasher, eqer);
ret {map: m, mutable vect: [], hasher: hasher, eqer: eqer};
ret {map: m, mut vect: [], hasher: hasher, eqer: eqer};
}
fn intern<T: copy>(itr: interner<T>, val: T) -> uint {

View file

@ -68,8 +68,8 @@ fn log_stmt_err(st: ast::stmt) {
}
fn has_nonlocal_exits(b: ast::blk) -> bool {
let has_exits = @mutable false;
fn visit_expr(flag: @mutable bool, e: @ast::expr) {
let has_exits = @mut false;
fn visit_expr(flag: @mut bool, e: @ast::expr) {
alt e.node {
ast::expr_break { *flag = true; }
ast::expr_cont { *flag = true; }
@ -85,8 +85,8 @@ fn has_nonlocal_exits(b: ast::blk) -> bool {
/* FIXME: copy/paste, yuck */
fn may_break(b: ast::blk) -> bool {
let has_exits = @mutable false;
fn visit_expr(flag: @mutable bool, e: @ast::expr) {
let has_exits = @mut false;
fn visit_expr(flag: @mut bool, e: @ast::expr) {
alt e.node {
ast::expr_break { *flag = true; }
_ { }

View file

@ -104,7 +104,7 @@ fn exec<T:send>(
}
fn build_ctxt(sess: session::session, ast: @ast::crate,
ignore_errors: @mutable bool) -> ctxt {
ignore_errors: @mut bool) -> ctxt {
import rustc::front::config;
@ -125,7 +125,7 @@ fn build_ctxt(sess: session::session, ast: @ast::crate,
// FIXME: this whole structure should not be duplicated here. makes it
// painful to add or remove options.
fn build_session() -> (session::session, @mutable bool) {
fn build_session() -> (session::session, @mut bool) {
let sopts: @session::options = @{
crate_type: session::lib_crate,
static: false,
@ -163,7 +163,7 @@ fn build_session() -> (session::session, @mutable bool) {
type error_handlers = {
emitter: diagnostic::emitter,
span_handler: diagnostic::span_handler,
ignore_errors: @mutable bool
ignore_errors: @mut bool
};
// Build a custom error handler that will allow us to ignore non-fatal
@ -174,7 +174,7 @@ fn build_error_handlers(
type diagnostic_handler = {
inner: diagnostic::handler,
ignore_errors: @mutable bool
ignore_errors: @mut bool
};
impl of diagnostic::handler for diagnostic_handler {
@ -197,7 +197,7 @@ fn build_error_handlers(
}
}
let ignore_errors = @mutable false;
let ignore_errors = @mut false;
let emitter = fn@(cmsp: option<(codemap::codemap, codemap::span)>,
msg: str, lvl: diagnostic::level) {
if !(*ignore_errors) {

View file

@ -29,10 +29,10 @@ mod test {
let handler = diagnostic::mk_handler(none);
let parse_sess = @{
cm: cm,
mutable next_id: 0,
mut next_id: 0,
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
mutable chpos: 0u,
mutable byte_pos: 0u
mut chpos: 0u,
mut byte_pos: 0u
};
let parser = parser::new_parser_from_source_str(
parse_sess, [], "-", codemap::fss_none, @source);

View file

@ -14,10 +14,10 @@ fn new_parse_sess() -> parser::parse_sess {
let handler = diagnostic::mk_handler(none);
let sess = @{
cm: cm,
mutable next_id: 1,
mut next_id: 1,
span_diagnostic: diagnostic::mk_span_handler(handler, cm),
mutable chpos: 0u,
mutable byte_pos: 0u
mut chpos: 0u,
mut byte_pos: 0u
};
ret sess;
}

View file

@ -11,13 +11,13 @@ fn mk_pass() -> pass {
type ctxt = {
srv: astsrv::srv,
mutable path: [str]
mut path: [str]
};
fn run(srv: astsrv::srv, doc: doc::doc) -> doc::doc {
let ctxt = {
srv: srv,
mutable path: []
mut path: []
};
let fold = fold::fold({
fold_item: fold_item,

BIN
src/rustdoc/rustdoc Executable file

Binary file not shown.

View file

@ -2,7 +2,7 @@ mod kitties {
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
}
let how_hungry : int;

View file

@ -2,7 +2,7 @@ mod kitties {
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
}
let how_hungry : int;

View file

@ -2,7 +2,7 @@ mod kitties {
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
}
let how_hungry : int;

View file

@ -2,7 +2,7 @@ mod kitties {
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
fn meow() {
#error("Meow");
meows += 1u;

View file

@ -2,7 +2,7 @@ mod kitties {
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
fn nap() { uint::range(1u, 10000u) {|_i|}}
}

View file

@ -13,7 +13,7 @@ import str;
fn LINE_LENGTH() -> uint { ret 60u; }
type myrandom = @{mutable last: u32};
type myrandom = @{mut last: u32};
fn myrandom_next(r: myrandom, mx: u32) -> u32 {
r.last = (r.last * 3877u32 + 29573u32) % 139968u32;
@ -44,7 +44,7 @@ fn select_random(r: u32, genelist: [aminoacids]) -> char {
fn make_random_fasta(id: str, desc: str, genelist: [aminoacids], n: int) {
log(debug, ">" + id + " " + desc);
let rng = @{mutable last: std::rand::rng().next()};
let rng = @{mut last: std::rand::rng().next()};
let mut op: str = "";
uint::range(0u, n as uint) {|_i|
str::push_char(op, select_random(myrandom_next(rng, 100u32),

View file

@ -136,61 +136,61 @@ mod Body {
const DAYS_PER_YEAR: float = 365.24;
type props =
{mutable x: float,
mutable y: float,
mutable z: float,
mutable vx: float,
mutable vy: float,
mutable vz: float,
{mut x: float,
mut y: float,
mut z: float,
mut vx: float,
mut vy: float,
mut vz: float,
mass: float};
fn jupiter() -> Body::props {
ret {mutable x: 4.84143144246472090e+00,
mutable y: -1.16032004402742839e+00,
mutable z: -1.03622044471123109e-01,
mutable vx: 1.66007664274403694e-03 * DAYS_PER_YEAR,
mutable vy: 7.69901118419740425e-03 * DAYS_PER_YEAR,
mutable vz: -6.90460016972063023e-05 * DAYS_PER_YEAR,
ret {mut x: 4.84143144246472090e+00,
mut y: -1.16032004402742839e+00,
mut z: -1.03622044471123109e-01,
mut vx: 1.66007664274403694e-03 * DAYS_PER_YEAR,
mut vy: 7.69901118419740425e-03 * DAYS_PER_YEAR,
mut vz: -6.90460016972063023e-05 * DAYS_PER_YEAR,
mass: 9.54791938424326609e-04 * SOLAR_MASS};
}
fn saturn() -> Body::props {
ret {mutable x: 8.34336671824457987e+00,
mutable y: 4.12479856412430479e+00,
mutable z: -4.03523417114321381e-01,
mutable vx: -2.76742510726862411e-03 * DAYS_PER_YEAR,
mutable vy: 4.99852801234917238e-03 * DAYS_PER_YEAR,
mutable vz: 2.30417297573763929e-05 * DAYS_PER_YEAR,
ret {mut x: 8.34336671824457987e+00,
mut y: 4.12479856412430479e+00,
mut z: -4.03523417114321381e-01,
mut vx: -2.76742510726862411e-03 * DAYS_PER_YEAR,
mut vy: 4.99852801234917238e-03 * DAYS_PER_YEAR,
mut vz: 2.30417297573763929e-05 * DAYS_PER_YEAR,
mass: 2.85885980666130812e-04 * SOLAR_MASS};
}
fn uranus() -> Body::props {
ret {mutable x: 1.28943695621391310e+01,
mutable y: -1.51111514016986312e+01,
mutable z: -2.23307578892655734e-01,
mutable vx: 2.96460137564761618e-03 * DAYS_PER_YEAR,
mutable vy: 2.37847173959480950e-03 * DAYS_PER_YEAR,
mutable vz: -2.96589568540237556e-05 * DAYS_PER_YEAR,
ret {mut x: 1.28943695621391310e+01,
mut y: -1.51111514016986312e+01,
mut z: -2.23307578892655734e-01,
mut vx: 2.96460137564761618e-03 * DAYS_PER_YEAR,
mut vy: 2.37847173959480950e-03 * DAYS_PER_YEAR,
mut vz: -2.96589568540237556e-05 * DAYS_PER_YEAR,
mass: 4.36624404335156298e-05 * SOLAR_MASS};
}
fn neptune() -> Body::props {
ret {mutable x: 1.53796971148509165e+01,
mutable y: -2.59193146099879641e+01,
mutable z: 1.79258772950371181e-01,
mutable vx: 2.68067772490389322e-03 * DAYS_PER_YEAR,
mutable vy: 1.62824170038242295e-03 * DAYS_PER_YEAR,
mutable vz: -9.51592254519715870e-05 * DAYS_PER_YEAR,
ret {mut x: 1.53796971148509165e+01,
mut y: -2.59193146099879641e+01,
mut z: 1.79258772950371181e-01,
mut vx: 2.68067772490389322e-03 * DAYS_PER_YEAR,
mut vy: 1.62824170038242295e-03 * DAYS_PER_YEAR,
mut vz: -9.51592254519715870e-05 * DAYS_PER_YEAR,
mass: 5.15138902046611451e-05 * SOLAR_MASS};
}
fn sun() -> Body::props {
ret {mutable x: 0.0,
mutable y: 0.0,
mutable z: 0.0,
mutable vx: 0.0,
mutable vy: 0.0,
mutable vz: 0.0,
ret {mut x: 0.0,
mut y: 0.0,
mut z: 0.0,
mut vx: 0.0,
mut vy: 0.0,
mut vz: 0.0,
mass: SOLAR_MASS};
}

View file

@ -6,7 +6,7 @@ fn eval_A(i: uint, j: uint) -> float {
1.0/(((i+j)*(i+j+1u)/2u+i+1u) as float)
}
fn eval_A_times_u(u: [const float], Au: [mutable float]) {
fn eval_A_times_u(u: [const float], Au: [mut float]) {
let N = vec::len(u);
let mut i = 0u;
while i < N {
@ -20,7 +20,7 @@ fn eval_A_times_u(u: [const float], Au: [mutable float]) {
}
}
fn eval_At_times_u(u: [const float], Au: [mutable float]) {
fn eval_At_times_u(u: [const float], Au: [mut float]) {
let N = vec::len(u);
let mut i = 0u;
while i < N {
@ -34,7 +34,7 @@ fn eval_At_times_u(u: [const float], Au: [mutable float]) {
}
}
fn eval_AtA_times_u(u: [const float], AtAu: [mutable float]) {
fn eval_AtA_times_u(u: [const float], AtAu: [mut float]) {
let v = vec::to_mut(vec::from_elem(vec::len(u), 0.0));
eval_A_times_u(u, v);
eval_At_times_u(v, AtAu);

View file

@ -22,7 +22,7 @@ import io::{writer_util, reader_util};
export grid_t, read_grid, solve_grid, write_grid;
// internal type of sudoku grids
type grid = [[mutable u8]];
type grid = [[mut u8]];
// exported type of sudoku grids
enum grid_t { grid_ctor(grid), }

View file

@ -103,10 +103,10 @@ mod map_reduce {
send(out, chan(p));
let state = @{mutable ref_count: 0, mutable is_done: false};
let state = @{mut ref_count: 0, mut is_done: false};
fn get(p: port<reduce_proto>, state: @{mutable ref_count: int,
mutable is_done: bool})
fn get(p: port<reduce_proto>, state: @{mut ref_count: int,
mut is_done: bool})
-> option<int> {
while !state.is_done || state.ref_count > 0 {
alt recv(p) {

View file

@ -1,7 +1,7 @@
// error-pattern:assigning to immutable field
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
}
let how_hungry : int;

View file

@ -1,10 +1,10 @@
// error-pattern: mismatched types
fn main() {
let v = @mutable [0];
let v = @mut [0];
fn f(&&v: @mutable [const int]) {
*v = [mutable 3]
fn f(&&v: @mut [const int]) {
*v = [mut 3]
}
f(v);

View file

@ -1,9 +1,9 @@
// error-pattern: mismatched types
fn main() {
let v = [mutable @mutable ~mutable [0]];
let v = [mut @mut ~mut [0]];
fn f(&&v: [mutable @mutable ~mutable [const int]]) {
fn f(&&v: [mut @mut ~mut [const int]]) {
}
f(v);

View file

@ -4,11 +4,11 @@ use std;
fn main() {
let a = [0];
let v: *mutable [int] = ptr::mut_addr_of(a);
let v: *mut [int] = ptr::mut_addr_of(a);
fn f(&&v: *mutable [const int]) {
fn f(&&v: *mut [const int]) {
unsafe {
*v = [mutable 3]
*v = [mut 3]
}
}

View file

@ -1,10 +1,10 @@
// error-pattern: mismatched types
fn main() {
let v = {mutable g: [0]};
let v = {mut g: [0]};
fn f(&&v: {mutable g: [const int]}) {
v.g = [mutable 3]
fn f(&&v: {mut g: [const int]}) {
v.g = [mut 3]
}
f(v);

View file

@ -1,10 +1,10 @@
// error-pattern: mismatched types
fn main() {
let v = ~mutable [0];
let v = ~mut [0];
fn f(&&v: ~mutable [const int]) {
*v = [mutable 3]
fn f(&&v: ~mut [const int]) {
*v = [mut 3]
}
f(v);

View file

@ -2,10 +2,10 @@ fn main() {
// Note: explicit type annot is required here
// because otherwise the inference gets smart
// and assigns a type of [mut [const int]].
let v: [mut [int]] = [mutable [0]];
let v: [mut [int]] = [mut [0]];
fn f(&&v: [mutable [const int]]) {
v[0] = [mutable 3]
fn f(&&v: [mut [const int]]) {
v[0] = [mut 3]
}
f(v); //! ERROR (values differ in mutability)

View file

@ -2,9 +2,9 @@ fn main() {
// Note: explicit type annot is required here
// because otherwise the inference gets smart
// and assigns a type of [mut [const int]].
let v: [mut [mut int]] = [mutable [mutable 0]];
let v: [mut [mut int]] = [mut [mut 0]];
fn f(&&v: [mutable [const int]]) {
fn f(&&v: [mut [const int]]) {
v[0] = [3]
}

View file

@ -2,10 +2,10 @@ fn main() {
// Note: explicit type annot is required here
// because otherwise the inference gets smart
// and assigns a type of [mut [const int]].
let v: [mut[mut[int]]] = [mutable [mutable [0]]];
let v: [mut[mut[int]]] = [mut [mut [0]]];
fn f(&&v: [mutable [mutable [const int]]]) {
v[0][1] = [mutable 3]
fn f(&&v: [mut [mut [const int]]]) {
v[0][1] = [mut 3]
}
f(v); //! ERROR (values differ in mutability)

View file

@ -1,11 +1,11 @@
// error-pattern: copying a noncopyable value
resource r(i: @mutable int) {
resource r(i: @mut int) {
*i = *i + 1;
}
fn main() {
let i = @mutable 0;
let i = @mut 0;
{
// Can't do this copy
let x = ~~~{y: r(i)};

View file

@ -1,7 +1,7 @@
// error-pattern:no public field or method with that name
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
}
let how_hungry : int;

View file

@ -1,7 +1,7 @@
// error-pattern:attempted access of field nap on type
class cat {
priv {
let mutable meows : uint;
let mut meows : uint;
fn nap() { uint::range(1u, 10000u) {|_i|}}
}

Some files were not shown because too many files have changed in this diff Show more