diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 74f1e372c07..d5d0cde1ee0 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -1842,7 +1842,7 @@ pub fn store_arg(mut bcx: block, fn mk_binding_alloca(mut bcx: block, p_id: ast::node_id, - path: @ast::Path, + path: &ast::Path, binding_mode: IrrefutablePatternBindingMode, populate: &fn(block, ty::t, ValueRef) -> block) -> block { let var_ty = node_id_type(bcx, p_id); @@ -1899,7 +1899,7 @@ fn bind_irrefutable_pat(bcx: block, let tcx = bcx.tcx(); let ccx = bcx.ccx(); match pat.node { - ast::pat_ident(pat_binding_mode, path, inner) => { + ast::pat_ident(pat_binding_mode, ref path, inner) => { if pat_is_binding(tcx.def_map, pat) { // Allocate the stack slot where the value of this // binding will live and place it into the appropriate @@ -2017,9 +2017,9 @@ fn bind_irrefutable_pat(bcx: block, return bcx; } -fn simple_identifier(pat: @ast::pat) -> Option<@ast::Path> { +fn simple_identifier<'a>(pat: &'a ast::pat) -> Option<&'a ast::Path> { match pat.node { - ast::pat_ident(ast::bind_infer, path, None) => { + ast::pat_ident(ast::bind_infer, ref path, None) => { Some(path) } _ => { diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index c8117ed64a7..80fc3803ae7 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -1969,17 +1969,17 @@ pub fn trans_tuple_struct(ccx: @mut CrateContext, trait IdAndTy { fn id(&self) -> ast::node_id; - fn ty(&self) -> @ast::Ty; + fn ty<'a>(&'a self) -> &'a ast::Ty; } impl IdAndTy for ast::variant_arg { fn id(&self) -> ast::node_id { self.id } - fn ty(&self) -> @ast::Ty { self.ty } + fn ty<'a>(&'a self) -> &'a ast::Ty { &self.ty } } impl IdAndTy for @ast::struct_field { fn id(&self) -> ast::node_id { self.node.id } - fn ty(&self) -> @ast::Ty { self.node.ty } + fn ty<'a>(&'a self) -> &'a ast::Ty { &self.node.ty } } pub fn trans_enum_variant_or_tuple_like_struct( @@ -1994,7 +1994,7 @@ pub fn trans_enum_variant_or_tuple_like_struct( let fn_args = do args.map |varg| { ast::arg { is_mutbl: false, - ty: varg.ty(), + ty: copy *varg.ty(), pat: ast_util::ident_to_pat( ccx.tcx.sess.next_node_id(), codemap::dummy_sp(), @@ -2977,8 +2977,12 @@ pub fn trans_crate(sess: session::Session, do sort::quick_sort(ccx.stats.fn_stats) |&(_, _, insns_a), &(_, _, insns_b)| { insns_a > insns_b } - for ccx.stats.fn_stats.iter().advance |&(name, ms, insns)| { - io::println(fmt!("%u insns, %u ms, %s", insns, ms, name)); + for ccx.stats.fn_stats.iter().advance |tuple| { + match *tuple { + (ref name, ms, insns) => { + io::println(fmt!("%u insns, %u ms, %s", insns, ms, *name)); + } + } } } if ccx.sess.count_llvm_insns() { diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 473d5b8e6e8..7ee731d4f46 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -209,7 +209,7 @@ impl CoherenceChecker { match item.node { item_impl(_, ref opt_trait, _, _) => { let opt_trait : ~[trait_ref] = opt_trait.iter() - .transform(|&x| x) + .transform(|x| copy *x) .collect(); self.check_implementation(item, opt_trait); } @@ -270,7 +270,7 @@ impl CoherenceChecker { // We only want to generate one Impl structure. When we generate one, // we store it here so that we don't recreate it. let mut implementation_opt = None; - for associated_traits.iter().advance |&associated_trait| { + for associated_traits.iter().advance |associated_trait| { let trait_ref = ty::node_id_to_trait_ref( self.crate_context.tcx, diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index c546be63138..a69ffca026b 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1277,7 +1277,7 @@ impl OwnedVector for ~[T] { let valptr = ptr::to_mut_unsafe_ptr(&mut self[ln - 1u]); unsafe { raw::set_len(self, ln - 1u); - ptr::read_ptr(valptr) + Some(ptr::read_ptr(valptr)) } } } diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index d3554d6b27c..3bc16477c80 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -519,8 +519,8 @@ impl<'self> MethodDef<'self> { // create the generics that aren't for Self let fn_generics = self.generics.to_generics(cx, span, type_ident, generics); - let args = do arg_types.map |&(id, ty)| { - cx.arg(span, id, ty) + let args = do arg_types.map |pair| { + cx.arg(span, pair.first(), pair.second()) }; let ret_type = self.get_ret_ty(cx, span, generics, type_ident); @@ -896,8 +896,8 @@ pub fn create_subpatterns(cx: @ExtCtxt, field_paths: ~[ast::Path], mutbl: ast::mutability) -> ~[@ast::pat] { - do field_paths.map |&path| { - cx.pat(span, ast::pat_ident(ast::bind_by_ref(mutbl), path, None)) + do field_paths.map |path| { + cx.pat(span, ast::pat_ident(ast::bind_by_ref(mutbl), copy *path, None)) } } diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 98fc9aa6178..478c0861990 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -137,7 +137,7 @@ impl gen_send for message { let arg_names = vec::from_fn(tys.len(), |i| "x_" + i.to_str()); let args_ast: ~[ast::arg] = arg_names.iter().zip(tys.iter()) - .transform(|(&n, t)| cx.arg(span, cx.ident_of(n), copy *t)).collect(); + .transform(|(n, t)| cx.arg(span, cx.ident_of(*n), copy *t)).collect(); let args_ast = vec::append( ~[cx.arg(span, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c43b350abdb..8666c84bbef 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3914,7 +3914,7 @@ impl Parser { }; let full_path = full_path.normalize(); - let maybe_i = do self.sess.included_mod_stack.iter().position |&p| { p == full_path }; + let maybe_i = do self.sess.included_mod_stack.iter().position |p| { *p == full_path }; match maybe_i { Some(i) => { let stack = &self.sess.included_mod_stack; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index f9504a696ce..c3710853615 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1526,7 +1526,7 @@ pub fn print_bounded_path(s: @ps, path: &ast::Path, print_path_(s, path, false, bounds) } -pub fn print_pat(s: @ps, pat: @ast::pat) { +pub fn print_pat(s: @ps, pat: &ast::pat) { maybe_print_comment(s, pat.span.lo); let ann_node = node_pat(s, pat); (s.ann.pre)(ann_node);