diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-30 20:55:22 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-31 22:50:26 -0500 |
| commit | 28ea99eaa6dc052cd3d934769a5c92d144ae5bb2 (patch) | |
| tree | ed2a9b74786eece3e5aa3fb8e2b76a06af1a11f3 /src | |
| parent | a6f30532081fe2eab4b8f24008d494ff2ced9b7f (diff) | |
| download | rust-28ea99eaa6dc052cd3d934769a5c92d144ae5bb2.tar.gz rust-28ea99eaa6dc052cd3d934769a5c92d144ae5bb2.zip | |
rustc_borrowck: unbox closures used in let bindings
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_borrowck/borrowck/fragments.rs | 18 | ||||
| -rw-r--r-- | src/librustc_borrowck/borrowck/gather_loans/restrictions.rs | 2 | ||||
| -rw-r--r-- | src/librustc_borrowck/borrowck/mod.rs | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/librustc_borrowck/borrowck/fragments.rs b/src/librustc_borrowck/borrowck/fragments.rs index 070ae1151aa..90da8906a6f 100644 --- a/src/librustc_borrowck/borrowck/fragments.rs +++ b/src/librustc_borrowck/borrowck/fragments.rs @@ -44,7 +44,7 @@ enum Fragment { impl Fragment { fn loan_path_repr<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String { - let repr = |mpi| move_data.path_loan_path(mpi).repr(tcx); + let repr = |&: mpi| move_data.path_loan_path(mpi).repr(tcx); match *self { Just(mpi) => repr(mpi), AllButOneFrom(mpi) => format!("$(allbutone {})", repr(mpi)), @@ -54,7 +54,7 @@ impl Fragment { fn loan_path_user_string<'tcx>(&self, move_data: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) -> String { - let user_string = |mpi| move_data.path_loan_path(mpi).user_string(tcx); + let user_string = |&: mpi| move_data.path_loan_path(mpi).user_string(tcx); match *self { Just(mpi) => user_string(mpi), AllButOneFrom(mpi) => format!("$(allbutone {})", user_string(mpi)), @@ -140,9 +140,9 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>, if !span_err && !print { return; } - let instrument_all_paths = |kind, vec_rc: &Vec<MovePathIndex>| { + let instrument_all_paths = |&: kind, vec_rc: &Vec<MovePathIndex>| { for (i, mpi) in vec_rc.iter().enumerate() { - let render = || this.path_loan_path(*mpi).user_string(tcx); + let render = |&:| this.path_loan_path(*mpi).user_string(tcx); if span_err { tcx.sess.span_err(sp, format!("{}: `{}`", kind, render())[]); } @@ -152,9 +152,9 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>, } }; - let instrument_all_fragments = |kind, vec_rc: &Vec<Fragment>| { + let instrument_all_fragments = |&: kind, vec_rc: &Vec<Fragment>| { for (i, f) in vec_rc.iter().enumerate() { - let render = || f.loan_path_user_string(this, tcx); + let render = |&:| f.loan_path_user_string(this, tcx); if span_err { tcx.sess.span_err(sp, format!("{}: `{}`", kind, render())[]); } @@ -187,11 +187,11 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) { let mut moved = mem::replace(&mut fragments.moved_leaf_paths, vec![]); let mut assigned = mem::replace(&mut fragments.assigned_leaf_paths, vec![]); - let path_lps = |mpis: &[MovePathIndex]| -> Vec<String> { + let path_lps = |&: mpis: &[MovePathIndex]| -> Vec<String> { mpis.iter().map(|mpi| this.path_loan_path(*mpi).repr(tcx)).collect() }; - let frag_lps = |fs: &[Fragment]| -> Vec<String> { + let frag_lps = |&: fs: &[Fragment]| -> Vec<String> { fs.iter().map(|f| f.loan_path_repr(this, tcx)).collect() }; @@ -344,7 +344,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>, Rc<LoanPath<'tcx>>)>) { let parent_ty = parent_lp.to_type(); - let add_fragment_sibling_local = |field_name, variant_did| { + let mut add_fragment_sibling_local = |&mut : field_name, variant_did| { add_fragment_sibling_core( this, tcx, gathered_fragments, parent_lp.clone(), mc, field_name, origin_lp, variant_did); diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index b3fb7123ef3..ad31c52ca34 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -58,7 +58,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> { cmt: mc::cmt<'tcx>) -> RestrictionResult<'tcx> { debug!("restrict(cmt={})", cmt.repr(self.bccx.tcx)); - let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); + let new_lp = |&: v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); match cmt.cat.clone() { mc::cat_rvalue(..) => { diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index b57b76d66f7..c27b7b30e13 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -431,7 +431,7 @@ pub fn opt_loan_path<'tcx>(cmt: &mc::cmt<'tcx>) -> Option<Rc<LoanPath<'tcx>>> { //! which allows it to share common loan path pieces as it //! traverses the CMT. - let new_lp = |v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); + let new_lp = |&: v: LoanPathKind<'tcx>| Rc::new(LoanPath::new(v, cmt.ty)); match cmt.cat { mc::cat_rvalue(..) | |
