mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
rustc_borrowck: unbox closures used in let bindings
This commit is contained in:
parent
a6f3053208
commit
28ea99eaa6
@ -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);
|
||||
|
@ -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(..) => {
|
||||
|
@ -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(..) |
|
||||
|
Loading…
Reference in New Issue
Block a user