diff options
| author | ljedrz <ljedrz@gmail.com> | 2019-02-24 09:33:17 +0100 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2019-02-24 17:09:37 +0100 |
| commit | d7ced1dd5a6a58ed59b12b693fa1b45aadec0a9c (patch) | |
| tree | 013131c53da5d21330c8ca86bbd99df288855a01 /src/librustc_passes | |
| parent | 021a140dcdbbae9050818b3f28402385efab3adc (diff) | |
| download | rust-d7ced1dd5a6a58ed59b12b693fa1b45aadec0a9c.tar.gz rust-d7ced1dd5a6a58ed59b12b693fa1b45aadec0a9c.zip | |
hir: remove NodeId from Expr
Diffstat (limited to 'src/librustc_passes')
| -rw-r--r-- | src/librustc_passes/rvalue_promotion.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 20f31b3ebc1..c25884df87b 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -23,7 +23,7 @@ use rustc::middle::mem_categorization::Categorization; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::query::Providers; use rustc::ty::subst::Substs; -use rustc::util::nodemap::{ItemLocalSet, NodeSet}; +use rustc::util::nodemap::{ItemLocalSet, HirIdSet}; use rustc::hir; use rustc_data_structures::sync::Lrc; use syntax::ast; @@ -92,7 +92,7 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, in_fn: bool, in_static: bool, - mut_rvalue_borrows: NodeSet, + mut_rvalue_borrows: HirIdSet, param_env: ty::ParamEnv<'tcx>, identity_substs: &'tcx Substs<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -169,7 +169,7 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> { fn remove_mut_rvalue_borrow(&mut self, pat: &hir::Pat) -> bool { let mut any_removed = false; pat.walk(|p| { - any_removed |= self.mut_rvalue_borrows.remove(&p.id); + any_removed |= self.mut_rvalue_borrows.remove(&p.hir_id); true }); any_removed @@ -223,7 +223,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { hir::StmtKind::Local(ref local) => { if self.remove_mut_rvalue_borrow(&local.pat) { if let Some(init) = &local.init { - self.mut_rvalue_borrows.insert(init.id); + self.mut_rvalue_borrows.insert(init.hir_id); } } @@ -248,7 +248,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { outer &= check_adjustments(self, ex); // Handle borrows on (or inside the autorefs of) this expression. - if self.mut_rvalue_borrows.remove(&ex.id) { + if self.mut_rvalue_borrows.remove(&ex.hir_id) { outer = NotPromotable } @@ -318,7 +318,7 @@ fn check_expr_kind<'a, 'tcx>( } hir::ExprKind::Cast(ref from, _) => { let expr_promotability = v.check_expr(from); - debug!("Checking const cast(id={})", from.id); + debug!("Checking const cast(id={})", from.hir_id); match v.tables.cast_kinds().get(from.hir_id) { None => { v.tcx.sess.delay_span_bug(e.span, "no kind for cast"); @@ -456,9 +456,10 @@ fn check_expr_kind<'a, 'tcx>( hir::ExprKind::Closure(_capture_clause, ref _box_fn_decl, body_id, _span, _option_generator_movability) => { let nested_body_promotable = v.check_nested_body(body_id); + let node_id = v.tcx.hir().hir_to_node_id(e.hir_id); // Paths in constant contexts cannot refer to local variables, // as there are none, and thus closures can't have upvars there. - if v.tcx.with_freevars(e.id, |fv| !fv.is_empty()) { + if v.tcx.with_freevars(node_id, |fv| !fv.is_empty()) { NotPromotable } else { nested_body_promotable @@ -518,7 +519,7 @@ fn check_expr_kind<'a, 'tcx>( mut_borrow = v.remove_mut_rvalue_borrow(pat); } if mut_borrow { - v.mut_rvalue_borrows.insert(expr.id); + v.mut_rvalue_borrows.insert(expr.hir_id); } let _ = v.check_expr(expr); @@ -619,13 +620,13 @@ fn check_adjustments<'a, 'tcx>( impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'gcx> { fn consume(&mut self, - _consume_id: ast::NodeId, + _consume_id: hir::HirId, _consume_span: Span, _cmt: &mc::cmt_<'_>, _mode: euv::ConsumeMode) {} fn borrow(&mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, _borrow_span: Span, cmt: &mc::cmt_<'tcx>, _loan_region: ty::Region<'tcx>, @@ -678,7 +679,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'gcx> { fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) {} fn mutate(&mut self, - _assignment_id: ast::NodeId, + _assignment_id: hir::HirId, _assignment_span: Span, _assignee_cmt: &mc::cmt_<'_>, _mode: euv::MutateMode) { |
