diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-03-26 18:35:18 -0700 | 
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-03-26 18:35:18 -0700 | 
| commit | 6e6798c4e17d9ffa33c0573f329c772e9d96739e (patch) | |
| tree | 64d4a01e7ed41092983f623b9b0fe0e5abc25200 /src/rustc | |
| parent | 34283ce7e840cbec4ec5704616614dbccdc08e81 (diff) | |
| download | rust-6e6798c4e17d9ffa33c0573f329c772e9d96739e.tar.gz rust-6e6798c4e17d9ffa33c0573f329c772e9d96739e.zip | |
Bulk-edit mutable -> mut.
Diffstat (limited to 'src/rustc')
42 files changed, 314 insertions, 314 deletions
| diff --git a/src/rustc/driver/diagnostic.rs b/src/rustc/driver/diagnostic.rs index cb4d59e70a1..d76d0447b11 100644 --- a/src/rustc/driver/diagnostic.rs +++ b/src/rustc/driver/diagnostic.rs @@ -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 } diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index a71c5dcb0ca..349c29a6f85 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -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()} } diff --git a/src/rustc/driver/session.rs b/src/rustc/driver/session.rs index 79f9a44aaa0..d604db38e15 100644 --- a/src/rustc/driver/session.rs +++ b/src/rustc/driver/session.rs @@ -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 { diff --git a/src/rustc/front/attr.rs b/src/rustc/front/attr.rs index 599da3811d1..0230baefdc1 100644 --- a/src/rustc/front/attr.rs +++ b/src/rustc/front/attr.rs @@ -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); diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index 4af7e77bd87..d39936c10cc 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -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, _, _)), diff --git a/src/rustc/metadata/astencode.rs b/src/rustc/metadata/astencode.rs index 42f24b79851..51c97ef261e 100644 --- a/src/rustc/metadata/astencode.rs +++ b/src/rustc/metadata/astencode.rs @@ -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; } diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs index 92599591240..fa74efbc19c 100644 --- a/src/rustc/metadata/creader.rs +++ b/src/rustc/metadata/creader.rs @@ -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 { diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index 89e5343f6e4..36f2c28e74f 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -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 { diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 37d7cb60078..a573d0214dc 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -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); } diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs index 3a925fdcb5e..920a4d71a46 100644 --- a/src/rustc/metadata/tydecode.rs +++ b/src/rustc/metadata/tydecode.rs @@ -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) } diff --git a/src/rustc/middle/alias.rs b/src/rustc/middle/alias.rs index fd6e7eb3ff2..32e5ef91524 100644 --- a/src/rustc/middle/alias.rs +++ b/src/rustc/middle/alias.rs @@ -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; } diff --git a/src/rustc/middle/ast_map.rs b/src/rustc/middle/ast_map.rs index d2186a27ee8..3b9a868776b 100644 --- a/src/rustc/middle/ast_map.rs +++ b/src/rustc/middle/ast_map.rs @@ -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(); diff --git a/src/rustc/middle/block_use.rs b/src/rustc/middle/block_use.rs index 6646e1612c8..c0719e47ad3 100644 --- a/src/rustc/middle/block_use.rs +++ b/src/rustc/middle/block_use.rs @@ -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); diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs index 1a97b276afe..eacb5fef32c 100644 --- a/src/rustc/middle/check_alt.rs +++ b/src/rustc/middle/check_alt.rs @@ -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(), []))} }); diff --git a/src/rustc/middle/freevars.rs b/src/rustc/middle/freevars.rs index ad0f053884a..727cbac4f23 100644 --- a/src/rustc/middle/freevars.rs +++ b/src/rustc/middle/freevars.rs @@ -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>) { } diff --git a/src/rustc/middle/infer.rs b/src/rustc/middle/infer.rs index c0692e7c4a5..71419128eb1 100644 --- a/src/rustc/middle/infer.rs +++ b/src/rustc/middle/infer.rs @@ -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}) diff --git a/src/rustc/middle/last_use.rs b/src/rustc/middle/last_use.rs index d4849abfb27..aaa452a89c2 100644 --- a/src/rustc/middle/last_use.rs +++ b/src/rustc/middle/last_use.rs @@ -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; diff --git a/src/rustc/middle/mutbl.rs b/src/rustc/middle/mutbl.rs index 0c40305f14a..092afcdbedd 100644 --- a/src/rustc/middle/mutbl.rs +++ b/src/rustc/middle/mutbl.rs @@ -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 } }; diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 9e9c28daf6a..712ccbf02af 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -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) { diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index 8b8ee1fe81b..35294910923 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -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");; diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 35a73a0a530..808a500814e 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -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}; { diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 80c1895ed54..f68495b7561 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -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 diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs index 0896f9000f1..cbca8f63a52 100644 --- a/src/rustc/middle/trans/debuginfo.rs +++ b/src/rustc/middle/trans/debuginfo.rs @@ -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; diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index bcf73ca9774..a81caf11b36 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -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}; diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index f347d4e3320..61b09f0e01c 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -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] { diff --git a/src/rustc/middle/tstate/annotate.rs b/src/rustc/middle/tstate/annotate.rs index d4271693112..3693f22d6e2 100644 --- a/src/rustc/middle/tstate/annotate.rs +++ b/src/rustc/middle/tstate/annotate.rs @@ -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); diff --git a/src/rustc/middle/tstate/auxiliary.rs b/src/rustc/middle/tstate/auxiliary.rs index c973d15b40d..c568d1f0cfe 100644 --- a/src/rustc/middle/tstate/auxiliary.rs +++ b/src/rustc/middle/tstate/auxiliary.rs @@ -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; } diff --git a/src/rustc/middle/tstate/collect_locals.rs b/src/rustc/middle/tstate/collect_locals.rs index c0532c8222f..90099df6492 100644 --- a/src/rustc/middle/tstate/collect_locals.rs +++ b/src/rustc/middle/tstate/collect_locals.rs @@ -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, diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index deeef4f6826..a2796c94244 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -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}}]; diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index 8ef8841754c..3fb2c67509a 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -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(), diff --git a/src/rustc/syntax/ast.rs b/src/rustc/syntax/ast.rs index 1f0b40925bc..217977e9658 100644 --- a/src/rustc/syntax/ast.rs +++ b/src/rustc/syntax/ast.rs @@ -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) } diff --git a/src/rustc/syntax/codemap.rs b/src/rustc/syntax/codemap.rs index c242b142bcc..a1a117201fb 100644 --- a/src/rustc/syntax/codemap.rs +++ b/src/rustc/syntax/codemap.rs @@ -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, diff --git a/src/rustc/syntax/ext/base.rs b/src/rustc/syntax/ext/base.rs index 01da22e38a1..86f13822c6e 100644 --- a/src/rustc/syntax/ext/base.rs +++ b/src/rustc/syntax/ext/base.rs @@ -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 } diff --git a/src/rustc/syntax/ext/qquote.rs b/src/rustc/syntax/ext/qquote.rs index ce65d460f30..50d70ffa8d0 100644 --- a/src/rustc/syntax/ext/qquote.rs +++ b/src/rustc/syntax/ext/qquote.rs @@ -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 ... diff --git a/src/rustc/syntax/ext/simplext.rs b/src/rustc/syntax/ext/simplext.rs index 2223c5f0fd6..dfc7d5314fc 100644 --- a/src/rustc/syntax/ext/simplext.rs +++ b/src/rustc/syntax/ext/simplext.rs @@ -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) diff --git a/src/rustc/syntax/fold.rs b/src/rustc/syntax/fold.rs index ad649b28190..4630b99eda6 100644 --- a/src/rustc/syntax/fold.rs +++ b/src/rustc/syntax/fold.rs @@ -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(_), diff --git a/src/rustc/syntax/parse/lexer.rs b/src/rustc/syntax/parse/lexer.rs index 9b4387135d1..5613b736d06 100644 --- a/src/rustc/syntax/parse/lexer.rs +++ b/src/rustc/syntax/parse/lexer.rs @@ -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); diff --git a/src/rustc/syntax/parse/parser.rs b/src/rustc/syntax/parse/parser.rs index b35b68ea5e2..78d8d2b6133 100644 --- a/src/rustc/syntax/parse/parser.rs +++ b/src/rustc/syntax/parse/parser.rs @@ -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) { diff --git a/src/rustc/syntax/print/pp.rs b/src/rustc/syntax/print/pp.rs index bb71268870d..f116bab4fe4 100644 --- a/src/rustc/syntax/print/pp.rs +++ b/src/rustc/syntax/print/pp.rs @@ -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 { diff --git a/src/rustc/syntax/print/pprust.rs b/src/rustc/syntax/print/pprust.rs index 76f9f8527f4..071441fe8e8 100644 --- a/src/rustc/syntax/print/pprust.rs +++ b/src/rustc/syntax/print/pprust.rs @@ -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 */ } } diff --git a/src/rustc/syntax/util/interner.rs b/src/rustc/syntax/util/interner.rs index 65f52b2fc46..99a032aae94 100644 --- a/src/rustc/syntax/util/interner.rs +++ b/src/rustc/syntax/util/interner.rs @@ -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 { diff --git a/src/rustc/util/common.rs b/src/rustc/util/common.rs index 93c328ef2ab..1a6b7b0ccf9 100644 --- a/src/rustc/util/common.rs +++ b/src/rustc/util/common.rs @@ -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; } _ { } | 
