From 438bdd687b8604090676422239f95e92149caddd Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 27 Sep 2012 17:01:28 -0700 Subject: [PATCH] core: More option demoding --- src/compiletest/header.rs | 4 ++-- src/libcore/iter.rs | 4 ++-- src/libcore/option.rs | 27 +++++++++----------------- src/libcore/os.rs | 6 +++--- src/libcore/task/spawn.rs | 2 +- src/libsyntax/print/pprust.rs | 8 ++++---- src/libsyntax/visit.rs | 6 +++--- src/rustc/metadata/decoder.rs | 2 +- src/rustc/metadata/encoder.rs | 4 ++-- src/rustc/middle/astencode.rs | 18 ++++++++--------- src/rustc/middle/check_alt.rs | 2 +- src/rustc/middle/check_const.rs | 2 +- src/rustc/middle/kind.rs | 8 ++++---- src/rustc/middle/mem_categorization.rs | 4 ++-- src/rustc/middle/resolve.rs | 2 +- src/rustc/middle/trans/base.rs | 4 ++-- src/rustc/middle/trans/closure.rs | 2 +- src/rustc/middle/trans/common.rs | 2 +- src/rustc/middle/trans/type_use.rs | 4 ++-- src/rustc/middle/ty.rs | 2 +- src/rustc/middle/typeck/astconv.rs | 2 +- src/rustc/middle/typeck/check.rs | 10 +++++----- src/rustc/middle/typeck/check/alt.rs | 2 +- src/rustc/middle/typeck/coherence.rs | 2 +- 24 files changed, 60 insertions(+), 69 deletions(-) diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index d72a9d65e05..3071c9a70a1 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -41,11 +41,11 @@ fn load_props(testfile: &Path) -> test_props { } do parse_aux_build(ln).iter |ab| { - aux_builds.push(ab); + aux_builds.push(*ab); } do parse_exec_env(ln).iter |ee| { - exec_env.push(ee); + exec_env.push(*ee); } }; return { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index bc1955698fc..3a2f5d604c0 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -289,8 +289,8 @@ fn map,U,BU: Buildable>(v: IT, f: fn(T) -> U) -> BU { #[inline(always)] pure fn append,BT: Buildable>( lhs: IT, rhs: IT) -> BT { - let size_opt = lhs.size_hint().chain( - |sz1| rhs.size_hint().map(|sz2| sz1+*sz2)); + let size_opt = lhs.size_hint().chain_ref( + |sz1| rhs.size_hint().map(|sz2| *sz1+*sz2)); do build_sized_opt(size_opt) |push| { for lhs.each |x| { push(*x); } for rhs.each |x| { push(*x); } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index ae28c6db083..f92e1aebdb2 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -75,13 +75,18 @@ enum Option { if opt.is_some() { Some(f(option::unwrap(move opt))) } else { None } } -pure fn chain(opt: &Option, f: fn(T) -> Option) -> Option { +pure fn chain(+opt: Option, f: fn(+t: T) -> Option) -> Option { /*! * Update an optional value by optionally running its content through a * function that returns an option. */ - match *opt { Some(x) => f(x), None => None } + // XXX write with move match + if opt.is_some() { + f(unwrap(opt)) + } else { + None + } } pure fn chain_ref(opt: &Option, @@ -139,14 +144,7 @@ enum Option { match *opt { None => move def, Some(ref t) => f(t) } } -// This should change to by-copy mode; use iter_ref below for by reference -pure fn iter(opt: &Option, f: fn(T)) { - //! Performs an operation on the contained value or does nothing - - match *opt { None => (), Some(t) => f(t) } -} - -pure fn iter_ref(opt: &Option, f: fn(x: &T)) { +pure fn iter(opt: &Option, f: fn(x: &T)) { //! Performs an operation on the contained value by reference match *opt { None => (), Some(ref t) => f(t) } } @@ -182,13 +180,6 @@ fn swap_unwrap(opt: &mut Option) -> T { // Some of these should change to be &Option, some should not. See below. impl Option { - /** - * Update an optional value by optionally running its content through a - * function that returns an option. - */ - pure fn chain(f: fn(T) -> Option) -> Option { chain(&self, f) } - /// Performs an operation on the contained value or does nothing - pure fn iter(f: fn(T)) { iter(&self, f) } /// Returns true if the option equals `none` pure fn is_none() -> bool { is_none(&self) } /// Returns true if the option contains some value @@ -207,7 +198,7 @@ impl &Option { pure fn map_default(+def: U, f: fn(x: &T) -> U) -> U { map_default(self, move def, f) } /// Performs an operation on the contained value by reference - pure fn iter_ref(f: fn(x: &T)) { iter_ref(self, f) } + pure fn iter(f: fn(x: &T)) { iter(self, f) } /// Maps a `some` value from one type to another by reference pure fn map(f: fn(x: &T) -> U) -> Option { map(self, f) } /// Gets an immutable reference to the value inside a `some`. diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 0b67b136c7f..c1ea71c181b 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -884,7 +884,7 @@ fn homedir() { setenv(~"HOME", ~""); assert os::homedir().is_none(); - oldhome.iter(|s| setenv(~"HOME", s)); + oldhome.iter(|s| setenv(~"HOME", *s)); } #[test] @@ -911,9 +911,9 @@ fn homedir() { setenv(~"USERPROFILE", ~"/home/PaloAlto"); assert os::homedir() == Some(Path("/home/MountainView")); - option::iter(&oldhome, |s| setenv(~"HOME", s)); + option::iter(&oldhome, |s| setenv(~"HOME", *s)); option::iter(&olduserprofile, - |s| setenv(~"USERPROFILE", s)); + |s| setenv(~"USERPROFILE", *s)); } #[test] diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index f2568414392..45e0d0f1a0d 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -240,7 +240,7 @@ fn iterate(ancestors: &AncestorList, if need_unwind && !nobe_is_dead { do bail_opt.iter |bail_blk| { do with_parent_tg(&mut nobe.parent_group) |tg_opt| { - bail_blk(tg_opt) + (*bail_blk)(tg_opt) } } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 00652346e10..5d1067da762 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -979,7 +979,7 @@ fn print_mac(s: ps, m: ast::mac) { Some(@{node: ast::expr_vec(_, _), _}) => (), _ => word(s.s, ~" ") } - arg.iter(|a| print_expr(s, a)); + arg.iter(|a| print_expr(s, *a)); // FIXME: extension 'body' (#2339) } ast::mac_invoc_tt(pth, tts) => { @@ -1177,7 +1177,7 @@ fn print_field(s: ps, field: ast::field) { ast::expr_loop(blk, opt_ident) => { head(s, ~"loop"); space(s.s); - opt_ident.iter(|ident| {print_ident(s, ident); space(s.s)}); + opt_ident.iter(|ident| {print_ident(s, *ident); space(s.s)}); print_block(s, blk); } ast::expr_match(expr, arms) => { @@ -1360,12 +1360,12 @@ fn print_field(s: ps, field: ast::field) { ast::expr_break(opt_ident) => { word(s.s, ~"break"); space(s.s); - opt_ident.iter(|ident| {print_ident(s, ident); space(s.s)}); + opt_ident.iter(|ident| {print_ident(s, *ident); space(s.s)}); } ast::expr_again(opt_ident) => { word(s.s, ~"loop"); space(s.s); - opt_ident.iter(|ident| {print_ident(s, ident); space(s.s)}); + opt_ident.iter(|ident| {print_ident(s, *ident); space(s.s)}); } ast::expr_ret(result) => { word(s.s, ~"return"); diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 93ef9508610..e6fd65eb458 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -241,7 +241,7 @@ fn visit_pat(p: @pat, e: E, v: vt) { v.visit_pat(inner, e, v), pat_ident(_, path, inner) => { visit_path(path, e, v); - do option::iter(&inner) |subpat| { v.visit_pat(subpat, e, v)}; + do option::iter(&inner) |subpat| { v.visit_pat(*subpat, e, v)}; } pat_lit(ex) => v.visit_expr(ex, e, v), pat_range(e1, e2) => { v.visit_expr(e1, e, v); v.visit_expr(e2, e, v); } @@ -342,10 +342,10 @@ fn visit_struct_def(sd: @struct_def, nm: ast::ident, tps: ~[ty_param], visit_path(p.path, e, v); } do option::iter(&sd.ctor) |ctor| { - visit_class_ctor_helper(ctor, nm, tps, ast_util::local_def(id), e, v); + visit_class_ctor_helper(*ctor, nm, tps, ast_util::local_def(id), e, v); }; do option::iter(&sd.dtor) |dtor| { - visit_class_dtor_helper(dtor, tps, ast_util::local_def(id), e, v) + visit_class_dtor_helper(*dtor, tps, ast_util::local_def(id), e, v) }; } diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index bebf8344c08..d7fd8036c46 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -204,7 +204,7 @@ fn field_mutability(d: ebml::Doc) -> ast::class_mutability { } fn variant_disr_val(d: ebml::Doc) -> Option { - do option::chain(&ebml::maybe_get_doc(d, tag_disr_val)) |val_doc| { + do option::chain(ebml::maybe_get_doc(d, tag_disr_val)) |val_doc| { int::parse_bytes(ebml::doc_data(val_doc), 10u) } } diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 8edee2bfe48..87ef3b4749c 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -609,7 +609,7 @@ fn add_to_index_(item: @item, ebml_w: ebml::Writer, ecx.tcx.sess.str_of(item.ident) + ~"_dtor"), path, if tps.len() > 0u { - Some(ii_dtor(dtor, item.ident, tps, + Some(ii_dtor(*dtor, item.ident, tps, local_def(item.id))) } else { None }, tps); } @@ -715,7 +715,7 @@ fn add_to_index_(item: @item, ebml_w: ebml::Writer, ebml_w.end_tag(); } do opt_trait.iter() |associated_trait| { - encode_trait_ref(ebml_w, ecx, associated_trait) + encode_trait_ref(ebml_w, ecx, *associated_trait) } encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident)); ebml_w.end_tag(); diff --git a/src/rustc/middle/astencode.rs b/src/rustc/middle/astencode.rs index acb7bb1bf2c..9332ebe9770 100644 --- a/src/rustc/middle/astencode.rs +++ b/src/rustc/middle/astencode.rs @@ -723,7 +723,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_def) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - ast::serialize_def(ebml_w, def) + ast::serialize_def(ebml_w, *def) } } } @@ -731,7 +731,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_node_type) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - ebml_w.emit_ty(ecx, ty); + ebml_w.emit_ty(ecx, *ty); } } } @@ -740,7 +740,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_node_type_subst) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - ebml_w.emit_tys(ecx, tys) + ebml_w.emit_tys(ecx, *tys) } } } @@ -749,7 +749,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_freevars) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - do ebml_w.emit_from_vec(*fv) |fv_entry| { + do ebml_w.emit_from_vec(**fv) |fv_entry| { encode_freevar_entry(ebml_w, *fv_entry) } } @@ -761,7 +761,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_tcache) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - ebml_w.emit_tpbt(ecx, tpbt); + ebml_w.emit_tpbt(ecx, *tpbt); } } } @@ -770,7 +770,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_param_bounds) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - ebml_w.emit_bounds(ecx, pbs) + ebml_w.emit_bounds(ecx, *pbs) } } } @@ -810,7 +810,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_method_map) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - serialize_method_map_entry(ecx, ebml_w, mme) + serialize_method_map_entry(ecx, ebml_w, *mme) } } } @@ -819,7 +819,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_vtable_map) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - encode_vtable_res(ecx, ebml_w, dr); + encode_vtable_res(ecx, ebml_w, *dr); } } } @@ -828,7 +828,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt, do ebml_w.tag(c::tag_table_adjustments) { ebml_w.id(id); do ebml_w.tag(c::tag_table_val) { - ty::serialize_AutoAdjustment(ebml_w, *adj) + ty::serialize_AutoAdjustment(ebml_w, **adj) } } } diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs index 54f415857ba..a3e85ac56c3 100644 --- a/src/rustc/middle/check_alt.rs +++ b/src/rustc/middle/check_alt.rs @@ -269,7 +269,7 @@ fn missing_ctor(tcx: ty::ctxt, m: matrix, left_ty: ty::t) -> Option { let mut found = ~[]; for m.each |r| { do option::iter(&pat_ctor_id(tcx, r[0])) |id| { - if !vec::contains(found, id) { found.push(id); } + if !vec::contains(found, *id) { found.push(*id); } } } let variants = ty::enum_variants(tcx, eid); diff --git a/src/rustc/middle/check_const.rs b/src/rustc/middle/check_const.rs index 53bdf3db868..bd3abe20134 100644 --- a/src/rustc/middle/check_const.rs +++ b/src/rustc/middle/check_const.rs @@ -28,7 +28,7 @@ fn check_item(sess: session, ast_map: ast_map::map, item_enum(enum_definition, _) => { for enum_definition.variants.each |var| { do option::iter(&var.node.disr_expr) |ex| { - v.visit_expr(ex, true, v); + v.visit_expr(*ex, true, v); } } } diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index 7d911f7d05a..15a7d8f52b1 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -264,15 +264,15 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt) { ~"non path/method call expr has type substs??") } }; - if vec::len(ts) != vec::len(*bounds) { + if vec::len(*ts) != vec::len(*bounds) { // Fail earlier to make debugging easier fail fmt!("Internal error: in kind::check_expr, length \ mismatch between actual and declared bounds: actual = \ %s (%u tys), declared = %? (%u tys)", - tys_to_str(cx.tcx, ts), ts.len(), + tys_to_str(cx.tcx, *ts), ts.len(), *bounds, (*bounds).len()); } - do vec::iter2(ts, *bounds) |ty, bound| { + do vec::iter2(*ts, *bounds) |ty, bound| { check_bounds(cx, id_to_use, e.span, ty, bound) } } @@ -376,7 +376,7 @@ fn check_ty(aty: @ty, cx: ctx, v: visit::vt) { do option::iter(&cx.tcx.node_type_substs.find(id)) |ts| { let did = ast_util::def_id_of_def(cx.tcx.def_map.get(id)); let bounds = ty::lookup_item_type(cx.tcx, did).bounds; - do vec::iter2(ts, *bounds) |ty, bound| { + do vec::iter2(*ts, *bounds) |ty, bound| { check_bounds(cx, aty.id, aty.span, ty, bound) } } diff --git a/src/rustc/middle/mem_categorization.rs b/src/rustc/middle/mem_categorization.rs index a9f4c195765..fe465db1312 100644 --- a/src/rustc/middle/mem_categorization.rs +++ b/src/rustc/middle/mem_categorization.rs @@ -670,14 +670,14 @@ fn cat_deref(node: N, match deref_kind(self.tcx, base_cmt.ty) { deref_ptr(ptr) => { - let lp = do base_cmt.lp.chain |l| { + let lp = do base_cmt.lp.chain_ref |l| { // Given that the ptr itself is loanable, we can // loan out deref'd uniq ptrs as the data they are // the only way to reach the data they point at. // Other ptr types admit aliases and are therefore // not loanable. match ptr { - uniq_ptr => {Some(@lp_deref(l, ptr))} + uniq_ptr => {Some(@lp_deref(*l, ptr))} gc_ptr | region_ptr(_) | unsafe_ptr => {None} } }; diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index def21ae03e0..03efd67a9d5 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -923,7 +923,7 @@ fn add_child(name: ident, namespace_to_str(ns), self.session.str_of(name))); do child.span_for_namespace(ns).iter() |sp| { - self.session.span_note(sp, + self.session.span_note(*sp, #fmt("First definition of %s %s here:", namespace_to_str(ns), self.session.str_of(name))); diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 47ac8e9ef6a..7c70d83bd76 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -1252,7 +1252,7 @@ fn alloc_local(cx: block, local: @ast::local) -> block { let val = alloc_ty(cx, t); if cx.sess().opts.debuginfo { do option::iter(&simple_name) |name| { - str::as_c_str(cx.ccx().sess.str_of(name), |buf| { + str::as_c_str(cx.ccx().sess.str_of(*name), |buf| { llvm::LLVMSetValueName(val, buf) }); } @@ -1778,7 +1778,7 @@ fn trans_class_dtor(ccx: @crate_ctxt, path: path, /* If we're monomorphizing, register the monomorphized decl for the dtor */ do option::iter(&hash_id) |h_id| { - ccx.monomorphized.insert(h_id, lldecl); + ccx.monomorphized.insert(*h_id, lldecl); } /* Translate the dtor body */ trans_fn(ccx, path, ast_util::dtor_dec(), diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs index 7b071866136..95c98126966 100644 --- a/src/rustc/middle/trans/closure.rs +++ b/src/rustc/middle/trans/closure.rs @@ -281,7 +281,7 @@ fn build_closure(bcx0: block, // variables: do option::iter(&include_ret_handle) |flagptr| { // Flag indicating we have returned (a by-ref bool): - let flag_datum = Datum {val: flagptr, ty: ty::mk_bool(tcx), + let flag_datum = Datum {val: *flagptr, ty: ty::mk_bool(tcx), mode: ByRef, source: FromLvalue}; env_vals.push(EnvValue {action: EnvRef, datum: flag_datum}); diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 6f14b22d778..e75d4db897f 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -472,7 +472,7 @@ fn info() -> Option { impl optional_boxed_ast_expr: get_node_info { fn info() -> Option { - self.chain(|s| s.info()) + self.chain_ref(|s| s.info()) } } diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index 8a0873f0585..b29f40748ed 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -204,7 +204,7 @@ fn mark_for_expr(cx: ctx, e: @expr) { expr_path(_) => { do cx.ccx.tcx.node_type_substs.find(e.id).iter |ts| { let id = ast_util::def_id_of_def(cx.ccx.tcx.def_map.get(e.id)); - vec::iter2(type_uses_for(cx.ccx, id, ts.len()), ts, + vec::iter2(type_uses_for(cx.ccx, id, ts.len()), *ts, |uses, subst| { type_needs(cx, uses, subst) }) @@ -238,7 +238,7 @@ fn mark_for_expr(cx: ctx, e: @expr) { match mth.origin { typeck::method_static(did) => { do cx.ccx.tcx.node_type_substs.find(e.id).iter |ts| { - do vec::iter2(type_uses_for(cx.ccx, did, ts.len()), ts) + do vec::iter2(type_uses_for(cx.ccx, did, ts.len()), *ts) |uses, subst| { type_needs(cx, uses, subst)} } } diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 06eb26ec4e7..63720eaad2e 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -902,7 +902,7 @@ fn rflags(r: region) -> uint { fn sflags(substs: &substs) -> uint { let mut f = 0u; for substs.tps.each |tt| { f |= get(*tt).flags; } - substs.self_r.iter(|r| f |= rflags(r)); + substs.self_r.iter(|r| f |= rflags(*r)); return f; } match st { diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs index 5434677b6fc..45a7c22e2f9 100644 --- a/src/rustc/middle/typeck/astconv.rs +++ b/src/rustc/middle/typeck/astconv.rs @@ -484,7 +484,7 @@ fn ty_of_fn_decl( let rb = in_binding_rscope(rscope); let input_tys = do decl.inputs.mapi |i, a| { - let expected_arg_ty = do expected_tys.chain |e| { + let expected_arg_ty = do expected_tys.chain_ref |e| { // no guarantee that the correct number of expected args // were supplied if i < e.inputs.len() {Some(e.inputs[i])} else {None} diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index c642f12cf62..e1a0e8bc9ed 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -279,7 +279,7 @@ fn check_fn(ccx: @crate_ctxt, // Update the self_info to contain an accurate self type (taking // into account explicit self). - let self_info = do self_info.chain |info| { + let self_info = do self_info.chain_ref |info| { // If the self type is sty_static, we don't have a self ty. if info.explicit_self.node == ast::sty_static { None @@ -288,7 +288,7 @@ fn check_fn(ccx: @crate_ctxt, let ty = method::transform_self_type_for_method( fcx.tcx(), self_region, info.self_ty, info.explicit_self.node); - Some({self_ty: ty,.. info}) + Some({self_ty: ty,.. *info}) } }; @@ -1864,7 +1864,7 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool, fcx.write_ty(id, typ); } ast::expr_rec(fields, base) => { - option::iter(&base, |b| { check_expr(fcx, b, expected); }); + option::iter(&base, |b| { check_expr(fcx, *b, expected); }); let expected = if expected.is_none() && base.is_some() { Some(fcx.expr_ty(base.get())) } else { expected }; @@ -1872,8 +1872,8 @@ fn check_field(fcx: @fn_ctxt, expr: @ast::expr, is_callee: bool, match sty { ty::ty_rec(flds) => Some(flds), _ => None } ); let fields_t = vec::map(fields, |f| { - bot |= check_expr(fcx, f.node.expr, flds.chain(|flds| - vec::find(flds, |tf| tf.ident == f.node.ident) + bot |= check_expr(fcx, f.node.expr, flds.chain_ref(|flds| + vec::find(*flds, |tf| tf.ident == f.node.ident) ).map(|tf| tf.mt.ty)); let expr_t = fcx.expr_ty(f.node.expr); let expr_mt = {ty: expr_t, mutbl: f.node.mutbl}; diff --git a/src/rustc/middle/typeck/check/alt.rs b/src/rustc/middle/typeck/check/alt.rs index 61d85b2dbfa..3b299caf872 100644 --- a/src/rustc/middle/typeck/check/alt.rs +++ b/src/rustc/middle/typeck/check/alt.rs @@ -164,7 +164,7 @@ fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path, } do subpats.iter() |pats| { - do vec::iter2(pats, arg_types) |subpat, arg_ty| { + do vec::iter2(*pats, arg_types) |subpat, arg_ty| { check_pat(pcx, subpat, arg_ty); } }; diff --git a/src/rustc/middle/typeck/coherence.rs b/src/rustc/middle/typeck/coherence.rs index 907cdb4f5ec..e9238e30c66 100644 --- a/src/rustc/middle/typeck/coherence.rs +++ b/src/rustc/middle/typeck/coherence.rs @@ -484,7 +484,7 @@ fn check_privileged_scopes(crate: @crate) { let trait_def_id = self.trait_ref_to_trait_def_id( - trait_ref); + *trait_ref); if trait_def_id.crate != local_crate { let session =