Remove 'deprecated mutable...' from our code

This should make compilation a bit less noisy.
This commit is contained in:
Marijn Haverbeke 2011-05-05 20:17:44 +02:00
parent 3d738e9e06
commit 1f45dda9d2
15 changed files with 43 additions and 43 deletions

View file

@ -382,7 +382,7 @@ fn scan_dec_digits(reader rdr) -> str {
ret res;
}
fn scan_number(mutable char c, reader rdr) -> token.token {
fn scan_number(char c, reader rdr) -> token.token {
auto accum_int = 0;
let str dec_str = "";
let bool is_dec_integer = false;

View file

@ -497,7 +497,7 @@ fn parse_arg(parser p) -> ast.arg {
fn parse_seq_to_end[T](token.token ket,
option.t[token.token] sep,
(fn(parser) -> T) f,
mutable uint hi,
uint hi,
parser p) -> vec[T] {
let bool first = true;
let vec[T] v = vec();

View file

@ -2281,7 +2281,7 @@ fn unify_step(@ctxt cx, t expected, t actual) -> result {
case (_) {
// Just bind the type variable to the expected type.
auto vlen = _vec.len[mutable vec[t]](cx.types);
auto vlen = _vec.len[vec[t]](cx.types);
if (actual_n < vlen) {
cx.types.(actual_n) += vec(expected);
} else {
@ -2649,7 +2649,7 @@ fn unify_step(@ctxt cx, t expected, t actual) -> result {
case (ty.ty_var(?expected_id)) {
// Add a binding.
auto expected_n = get_or_create_set(cx, expected_id);
auto vlen = _vec.len[mutable vec[t]](cx.types);
auto vlen = _vec.len[vec[t]](cx.types);
if (expected_n < vlen) {
cx.types.(expected_n) += vec(actual);
} else {
@ -2713,7 +2713,7 @@ fn substituter(@ctxt cx, vec[t] types, t typ) -> t {
fn unify_sets(@ctxt cx) -> vec[t] {
let vec[t] throwaway = vec();
let vec[mutable vec[t]] set_types = vec(mutable throwaway);
_vec.pop[mutable vec[t]](set_types); // FIXME: botch
_vec.pop[vec[t]](set_types); // FIXME: botch
for (UFind.node node in cx.sets.nodes) {
let vec[t] v = vec();
@ -2721,7 +2721,7 @@ fn unify_sets(@ctxt cx) -> vec[t] {
}
auto i = 0u;
while (i < _vec.len[mutable vec[t]](set_types)) {
while (i < _vec.len[vec[t]](set_types)) {
auto root = UFind.find(cx.sets, i);
set_types.(root) += cx.types.(i);
i += 1u;
@ -2746,7 +2746,7 @@ fn unify(t expected,
ty_ctxt tcx) -> result {
let vec[t] throwaway = vec();
let vec[mutable vec[t]] types = vec(mutable throwaway);
_vec.pop[mutable vec[t]](types); // FIXME: botch
_vec.pop[vec[t]](types); // FIXME: botch
auto cx = @rec(sets=UFind.make(),
var_ids=common.new_int_hash[uint](),
@ -2759,7 +2759,7 @@ fn unify(t expected,
case (ures_ok(?typ)) {
// Fast path: if there are no local variables, don't perform
// substitutions.
if (_vec.len[mutable UFind.node](cx.sets.nodes) == 0u) {
if (_vec.len(cx.sets.nodes) == 0u) {
ret ures_ok(typ);
}

View file

@ -843,7 +843,7 @@ fn simple(@fn_ctxt fcx, ty.t expected, ty.t actual) -> ty.Unify.result {
// FIXME: horrid botch
let vec[mutable ty.t] param_substs =
vec(mutable ty.mk_nil(fcx.ccx.tcx));
_vec.pop[mutable ty.t](param_substs);
_vec.pop(param_substs);
ret with_params(fcx, expected, actual, param_substs);
}
@ -1000,7 +1000,7 @@ fn full(@fn_ctxt fcx, &span sp, ty.t expected, ty.t actual,
let vec[mutable ty.t] ty_param_substs =
vec(mutable ty.mk_nil(fcx.ccx.tcx));
_vec.pop[mutable ty.t](ty_param_substs); // FIXME: horrid botch
_vec.pop(ty_param_substs); // FIXME: horrid botch
for (ty.t ty_param_subst in ty_param_substs_0) {
ty_param_substs += vec(mutable ty_param_subst);
}
@ -1009,7 +1009,7 @@ fn full(@fn_ctxt fcx, &span sp, ty.t expected, ty.t actual,
case (ures_ok(?t)) {
// TODO: Use "freeze", when we have it.
let vec[ty.t] result_ty_param_substs = vec();
for (mutable ty.t ty_param_subst in ty_param_substs) {
for (ty.t ty_param_subst in ty_param_substs) {
result_ty_param_substs += vec(ty_param_subst);
}
@ -2782,7 +2782,7 @@ fn hash_unify_cache_entry(&unify_cache_entry uce) -> uint {
h += h << 5u + ty.hash_ty(uce._1);
auto i = 0u;
auto tys_len = _vec.len[mutable ty.t](uce._2);
auto tys_len = _vec.len(uce._2);
while (i < tys_len) {
h += h << 5u + ty.hash_ty(uce._2.(i));
i += 1u;
@ -2795,8 +2795,8 @@ fn eq_unify_cache_entry(&unify_cache_entry a, &unify_cache_entry b) -> bool {
if (!ty.eq_ty(a._0, b._0) || !ty.eq_ty(a._1, b._1)) { ret false; }
auto i = 0u;
auto tys_len = _vec.len[mutable ty.t](a._2);
if (_vec.len[mutable ty.t](b._2) != tys_len) { ret false; }
auto tys_len = _vec.len(a._2);
if (_vec.len(b._2) != tys_len) { ret false; }
while (i < tys_len) {
if (!ty.eq_ty(a._2.(i), b._2.(i))) { ret false; }

View file

@ -8,12 +8,12 @@
fn make() -> ufind {
let vec[mutable node] v = vec(mutable none[uint]);
_vec.pop[mutable node](v); // FIXME: botch
_vec.pop(v); // FIXME: botch
ret rec(mutable nodes=v);
}
fn make_set(&ufind ufnd) -> uint {
auto idx = _vec.len[mutable node](ufnd.nodes);
auto idx = _vec.len(ufnd.nodes);
ufnd.nodes += vec(mutable none[uint]);
ret idx;
}

View file

@ -142,7 +142,7 @@ fn unsafe_from_bytes(vec[mutable? u8] v) -> str {
// FIXME even temp-er thing; rustc can use "unsafe_from_bytes" above
fn unsafe_from_mutable_bytes(vec[mutable u8] mv) -> str {
let vec[u8] v = vec();
for (mutable u8 b in mv) {
for (u8 b in mv) {
v += vec(b);
}
ret rustrt.str_from_vec(v);

View file

@ -11,7 +11,7 @@
fn ge(u8 x, u8 y) -> bool { ret x >= y; }
fn gt(u8 x, u8 y) -> bool { ret x > y; }
iter range(mutable u8 lo, u8 hi) -> u8 {
iter range(u8 lo, u8 hi) -> u8 {
while (lo < hi) {
put lo;
lo += 1u8;

View file

@ -190,7 +190,7 @@ fn unshift[T](&mutable array[T] v, &T t) {
v = res;
}
fn grow[T](&mutable array[T] v, uint n, &T initval) {
fn grow[T](&array[T] v, uint n, &T initval) {
let uint i = n;
while (i > 0u) {
i -= 1u;
@ -198,10 +198,10 @@ fn grow[T](&mutable array[T] v, uint n, &T initval) {
}
}
fn grow_set[T](&mutable vec[mutable T] v, uint index, &T initval, &T val) {
auto length = _vec.len[mutable T](v);
fn grow_set[T](&vec[mutable T] v, uint index, &T initval, &T val) {
auto length = _vec.len(v);
if (index >= length) {
grow[mutable T](v, index - length + 1u, initval);
grow(v, index - length + 1u, initval);
}
v.(index) = val;
}

View file

@ -26,9 +26,9 @@ fn create(uint nbits, bool init) -> t {
}
fn process(&fn(uint, uint) -> uint op, &t v0, &t v1) -> bool {
auto len = _vec.len[mutable uint](v1.storage);
auto len = _vec.len(v1.storage);
assert (_vec.len[mutable uint](v0.storage) == len);
assert (_vec.len(v0.storage) == len);
assert (v0.nbits == v1.nbits);
auto changed = false;
@ -76,7 +76,7 @@ fn copy(&t v0, t v1) -> bool {
fn clone(t v) -> t {
auto storage = _vec.init_elt_mut[uint](0u, v.nbits / uint_bits() + 1u);
auto len = _vec.len[mutable uint](v.storage);
auto len = _vec.len(v.storage);
for each (uint i in _uint.range(0u, len)) {
storage.(i) = v.storage.(i);
}
@ -97,7 +97,7 @@ fn get(&t v, uint i) -> bool {
fn equal(&t v0, &t v1) -> bool {
// FIXME: when we can break or return from inside an iterator loop,
// we can eliminate this painful while-loop
auto len = _vec.len[mutable uint](v1.storage);
auto len = _vec.len(v1.storage);
auto i = 0u;
while (i < len) {
if (v0.storage.(i) != v1.storage.(i)) {
@ -109,13 +109,13 @@ fn equal(&t v0, &t v1) -> bool {
}
fn clear(&t v) {
for each (uint i in _uint.range(0u, _vec.len[mutable uint](v.storage))) {
for each (uint i in _uint.range(0u, _vec.len(v.storage))) {
v.storage.(i) = 0u;
}
}
fn invert(&t v) {
for each (uint i in _uint.range(0u, _vec.len[mutable uint](v.storage))) {
for each (uint i in _uint.range(0u, _vec.len(v.storage))) {
v.storage.(i) = ~v.storage.(i);
}
}

View file

@ -19,7 +19,7 @@
fn create[T]() -> t[T] {
type cell[T] = mutable option.t[T];
type cell[T] = option.t[T];
let uint initial_capacity = 32u; // 2^5

View file

@ -451,7 +451,7 @@ fn stdout() -> writer {
state obj byte_buf_writer(mutable_byte_buf buf) {
fn write(vec[u8] v) {
// Fast path.
if (buf.pos == _vec.len[mutable u8](buf.buf)) {
if (buf.pos == _vec.len(buf.buf)) {
// FIXME: Fix our type system. There's no reason you shouldn't be
// able to add a mutable vector to an immutable one.
auto mv = _vec.rustrt.unsafe_vec_to_mut[u8](v);
@ -465,7 +465,7 @@ fn write(vec[u8] v) {
auto vpos = 0u;
while (vpos < vlen) {
auto b = v.(vpos);
if (buf.pos == _vec.len[mutable u8](buf.buf)) {
if (buf.pos == _vec.len(buf.buf)) {
buf.buf += vec(mutable b);
} else {
buf.buf.(buf.pos) = b;
@ -477,7 +477,7 @@ fn write(vec[u8] v) {
fn seek(int offset, seek_style whence) {
auto pos = buf.pos;
auto len = _vec.len[mutable u8](buf.buf);
auto len = _vec.len(buf.buf);
buf.pos = seek_in_buf(offset, pos, len, whence);
}
@ -487,7 +487,7 @@ fn seek(int offset, seek_style whence) {
fn string_writer() -> str_writer {
// FIXME: yikes, this is bad. Needs fixing of mutable syntax.
let vec[mutable u8] b = vec(mutable 0u8);
_vec.pop[mutable u8](b);
_vec.pop(b);
let mutable_byte_buf buf = @rec(mutable buf = b, mutable pos = 0u);
state obj str_writer_wrap(writer wr, mutable_byte_buf buf) {

View file

@ -66,7 +66,7 @@ fn dylib_filename(str base) -> str {
fn pipe() -> tup(int, int) {
let vec[mutable int] fds = vec(mutable 0, 0);
assert (os.libc.pipe(_vec.buf[mutable int](fds)) == 0);
assert (os.libc.pipe(_vec.buf(fds)) == 0);
ret tup(fds.(0), fds.(1));
}
@ -76,7 +76,7 @@ fn fd_FILE(int fd) -> libc.FILE {
fn waitpid(int pid) -> int {
let vec[mutable int] status = vec(mutable 0);
assert (os.libc.waitpid(pid, _vec.buf[mutable int](status), 0) != -1);
assert (os.libc.waitpid(pid, _vec.buf(status), 0) != -1);
ret status.(0);
}

View file

@ -67,7 +67,7 @@ fn add_input(&sha1state st, &vec[u8] msg) {
fn process_msg_block(&sha1state st) {
// FIXME: Make precondition
assert (_vec.len[mutable u32](st.h) == digest_buf_len);
assert (_vec.len(st.h) == digest_buf_len);
// Constants
auto k = vec(0x5A827999u32,
@ -192,7 +192,7 @@ fn mk_result(&sha1state st) -> vec[u8] {
*/
fn pad_msg(&sha1state st) {
// FIXME: Should be a precondition
assert (_vec.len[mutable u8](st.msg_block) == msg_block_len);
assert (_vec.len(st.msg_block) == msg_block_len);
/*
* Check to see if the current message block is too small to hold
@ -236,7 +236,7 @@ fn pad_msg(&sha1state st) {
fn reset() {
// FIXME: Should be typestate precondition
assert (_vec.len[mutable u32](st.h) == digest_buf_len);
assert (_vec.len(st.h) == digest_buf_len);
st.len_low = 0u32;
st.len_high = 0u32;

View file

@ -2,11 +2,11 @@
fn main() {
obj foo() {
fn m1(mutable int i) {
fn m1(int i) {
i += 1;
log "hi!";
}
fn m2(mutable int i) {
fn m2(int i) {
i += 1;
self.m1(i);
}

View file

@ -2,14 +2,14 @@
fn main() {
obj foo() {
fn m1(mutable int i) -> int {
fn m1(int i) -> int {
i += 1;
ret i;
}
fn m2(mutable int i) -> int {
fn m2(int i) -> int {
ret self.m1(i);
}
fn m3(mutable int i) -> int {
fn m3(int i) -> int {
i += 1;
ret self.m1(i);
}