]> git.lizzy.rs Git - rust.git/commitdiff
rustc: unbox closures used in let bindings
authorJorge Aparicio <japaricious@gmail.com>
Wed, 31 Dec 2014 01:37:02 +0000 (20:37 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Thu, 1 Jan 2015 03:50:26 +0000 (22:50 -0500)
src/librustc/metadata/creader.rs
src/librustc/metadata/encoder.rs
src/librustc/middle/check_const.rs
src/librustc/middle/check_match.rs
src/librustc/middle/infer/region_inference/graphviz.rs
src/librustc/middle/privacy.rs
src/librustc/middle/region.rs
src/librustc/middle/ty.rs

index e03d645aec3671a87f4d93a4272194c608ef9644..5dac2bafaec3d847508de229b3244ca3a169f812 100644 (file)
@@ -177,7 +177,7 @@ fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
 }
 
 pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
-    let err = |s: &str| {
+    let err = |&: s: &str| {
         match (sp, sess) {
             (_, None) => panic!("{}", s),
             (Some(sp), Some(sess)) => sess.span_err(sp, s),
index 5d0532a621022eb6723685784600bb62014c8e37..75fb6fb0cfa7ff79d3c390a09c0306351d214f1c 100644 (file)
@@ -1417,7 +1417,7 @@ fn add_to_index(item: &ast::Item, rbml_w: &Encoder,
             encode_parent_sort(rbml_w, 't');
 
             let trait_item = &ms[i];
-            let encode_trait_item = |rbml_w: &mut Encoder| {
+            let encode_trait_item = |&: rbml_w: &mut Encoder| {
                 // If this is a static method, we've already
                 // encoded this.
                 if is_nonstatic_method {
index e08dd64d4d4111480a01152c283d299668bb6da1..6277656e03afce8e97ec780138c507075cbe03c1 100644 (file)
@@ -185,7 +185,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &ast::Expr) -> bool {
         ast::ExprBlock(ref block) => {
             // Check all statements in the block
             for stmt in block.stmts.iter() {
-                let block_span_err = |span|
+                let block_span_err = |&: span|
                     span_err!(v.tcx.sess, span, E0016,
                               "blocks in constants are limited to items and \
                                tail expressions");
index 522e1d4d3b284a571ca9e952e408264dfcff1d43..4c5d76a2c40e57d0507faa689fc5106f21f02677 100644 (file)
@@ -1012,7 +1012,7 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
         })
     }
 
-    let check_move: |&Pat, Option<&Pat>| = |p, sub| {
+    let check_move = |&: p: &Pat, sub: Option<&Pat>| {
         // check legality of moving out of the enum
 
         // x @ Foo(..) is legal, but x @ Foo(y) isn't.
index 0ca1a593ce7fe55491440554e9e7d8d0789e3317..8455ee3955bd06cefa8348dc34b4c3f89d859c5a 100644 (file)
@@ -136,7 +136,7 @@ fn new(tcx: &'a ty::ctxt<'tcx>,
         let mut i = 0;
         let mut node_ids = FnvHashMap::new();
         {
-            let add_node = |node| {
+            let mut add_node = |&mut : node| {
                 if let Vacant(e) = node_ids.entry(node) {
                     e.set(i);
                     i += 1;
index edba2839f37eabc9476b5c8a85df7aae6e9d74de..cfa0d419aa3f0d53ae8f4b813edb8815e596f522 100644 (file)
@@ -749,7 +749,7 @@ fn check_static_method(&mut self,
     fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
         debug!("privacy - path {}", self.nodestr(path_id));
         let orig_def = self.tcx.def_map.borrow()[path_id].clone();
-        let ck = |tyname: &str| {
+        let ck = |&: tyname: &str| {
             let ck_public = |def: ast::DefId| {
                 let name = token::get_ident(path.segments.last().unwrap().identifier);
                 let origdid = orig_def.def_id();
@@ -921,7 +921,7 @@ struct type?!"),
                 }
             }
             ast::ExprPath(..) => {
-                let guard = |did: ast::DefId| {
+                let guard = |&: did: ast::DefId| {
                     let fields = ty::lookup_struct_fields(self.tcx, did);
                     let any_priv = fields.iter().any(|f| {
                         f.vis != ast::Public && (
@@ -1126,7 +1126,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
     /// later on down the road...
     fn check_sane_privacy(&self, item: &ast::Item) {
         let tcx = self.tcx;
-        let check_inherited = |sp: Span, vis: ast::Visibility, note: &str| {
+        let check_inherited = |&: sp: Span, vis: ast::Visibility, note: &str| {
             if vis != ast::Inherited {
                 tcx.sess.span_err(sp, "unnecessary visibility qualifier");
                 if note.len() > 0 {
@@ -1206,7 +1206,7 @@ fn check_inherited(tcx: &ty::ctxt, sp: Span, vis: ast::Visibility) {
                 tcx.sess.span_err(sp, "visibility has no effect inside functions");
             }
         }
-        let check_struct = |def: &ast::StructDef| {
+        let check_struct = |&: def: &ast::StructDef| {
             for f in def.fields.iter() {
                match f.node.kind {
                     ast::NamedField(_, p) => check_inherited(tcx, f.span, p),
index 392724bc9a18ee79ad35c13f15bc96fc92384031..be89b32cdaae623abcc75a94fe56defce6bb4c6e 100644 (file)
@@ -488,7 +488,7 @@ fn resolve_expr(visitor: &mut RegionResolutionVisitor, expr: &ast::Expr) {
 
     {
         let region_maps = &mut visitor.region_maps;
-        let terminating = |id| {
+        let terminating = |&: id| {
             let scope = CodeExtent::from_node_id(id);
             region_maps.mark_as_terminating_scope(scope)
         };
index ba52266e52d1801cb96007fed6824b2f8ffffc1a..c06a8c1569cb82098b13ff87c88505e3ca00418c 100644 (file)
@@ -6156,7 +6156,7 @@ fn helper<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh, state: &mut sip::SipS
         macro_rules! byte( ($b:expr) => { ($b as u8).hash(state) } );
         macro_rules! hash( ($e:expr) => { $e.hash(state) } );
 
-        let region = |state: &mut sip::SipState, r: Region| {
+        let region = |&: state: &mut sip::SipState, r: Region| {
             match r {
                 ReStatic => {}
                 ReLateBound(db, BrAnon(i)) => {
@@ -6173,7 +6173,7 @@ fn helper<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh, state: &mut sip::SipS
                 }
             }
         };
-        let did = |state: &mut sip::SipState, did: DefId| {
+        let did = |&: state: &mut sip::SipState, did: DefId| {
             let h = if ast_util::is_local(did) {
                 svh.clone()
             } else {
@@ -6182,10 +6182,10 @@ fn helper<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh, state: &mut sip::SipS
             h.as_str().hash(state);
             did.node.hash(state);
         };
-        let mt = |state: &mut sip::SipState, mt: mt| {
+        let mt = |&: state: &mut sip::SipState, mt: mt| {
             mt.mutbl.hash(state);
         };
-        let fn_sig = |state: &mut sip::SipState, sig: &Binder<FnSig<'tcx>>| {
+        let fn_sig = |&: state: &mut sip::SipState, sig: &Binder<FnSig<'tcx>>| {
             let sig = anonymize_late_bound_regions(tcx, sig);
             for a in sig.inputs.iter() { helper(tcx, *a, svh, state); }
             if let ty::FnConverging(output) = sig.output {