X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_borrowck%2Fborrowck%2Fgather_loans%2Fmod.rs;h=4ff603b7eae01441e9f26a0e646b92a72c6aa12a;hb=6f4ab9458a7ad06c8ce630604f533c8c0c0acef4;hp=3d669aa81df6e7bce6aa2bcdffcbe400b6613e55;hpb=6c5212ffa06d329bc9ca699e8687b6e45949b88a;p=rust.git diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 3d669aa81df..4ff603b7eae 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -41,7 +41,7 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, let def_id = bccx.tcx.hir.body_owner_def_id(body); let param_env = bccx.tcx.param_env(def_id); let mut glcx = GatherLoanCtxt { - bccx: bccx, + bccx, all_loans: Vec::new(), item_ub: region::CodeExtent::Misc(body.node_id), move_data: MoveData::new(), @@ -155,7 +155,9 @@ fn mutate(&mut self, } fn decl_without_init(&mut self, id: ast::NodeId, _span: Span) { - let ty = self.bccx.tables.node_id_to_type(id); + let ty = self.bccx + .tables + .node_id_to_type(self.bccx.tcx.hir.node_to_hir_id(id)); gather_moves::gather_decl(self.bccx, &self.move_data, id, ty); } } @@ -228,8 +230,8 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, // Only mutable data can be lent as mutable. if !cmt.mutbl.is_mutable() { Err(bccx.report(BckError { span: borrow_span, - cause: cause, - cmt: cmt, + cause, + cmt, code: err_mutbl })) } else { Ok(()) @@ -387,13 +389,13 @@ fn guarantee_valid(&mut self, Loan { index: self.all_loans.len(), - loan_path: loan_path, + loan_path, kind: req_kind, - gen_scope: gen_scope, - kill_scope: kill_scope, + gen_scope, + kill_scope, span: borrow_span, - restricted_paths: restricted_paths, - cause: cause, + restricted_paths, + cause, } } }; @@ -421,13 +423,13 @@ fn guarantee_valid(&mut self, // let all_loans = &mut *self.all_loans; // FIXME(#5074) // Loan { // index: all_loans.len(), - // loan_path: loan_path, - // cmt: cmt, + // loan_path, + // cmt, // mutbl: ConstMutability, // gen_scope: borrow_id, - // kill_scope: kill_scope, + // kill_scope, // span: borrow_span, - // restrictions: restrictions + // restrictions, // } // } } @@ -447,7 +449,8 @@ pub fn mark_loan_path_as_mutated(&self, loan_path: &LoanPath) { } None } - LpUpvar(ty::UpvarId{ var_id: local_id, closure_expr_id: _ }) => { + LpUpvar(ty::UpvarId{ var_id, closure_expr_id: _ }) => { + let local_id = self.tcx().hir.def_index_to_node_id(var_id); self.tcx().used_mut_nodes.borrow_mut().insert(local_id); None }