diff options
| author | Gary Guo <gary@garyguo.net> | 2025-02-26 15:59:38 +0000 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2025-02-26 17:13:32 +0000 |
| commit | 6e4adbed76ff406994682ee526366f6f2ea11b9f (patch) | |
| tree | a686c0f42c7c2b440ee5dd1aca6f321e36b46699 | |
| parent | 2af87eab3b4890d62ad998cf9c55e076d91bf06a (diff) | |
| download | rust-6e4adbed76ff406994682ee526366f6f2ea11b9f.tar.gz rust-6e4adbed76ff406994682ee526366f6f2ea11b9f.zip | |
Remove visit_const_block in typeck writeback
There is a `visit_inline_const` visitor method and it is used instead.
| -rw-r--r-- | compiler/rustc_hir_typeck/src/writeback.rs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/compiler/rustc_hir_typeck/src/writeback.rs b/compiler/rustc_hir_typeck/src/writeback.rs index 3e9ce0e11e4..6c6538d09de 100644 --- a/compiler/rustc_hir_typeck/src/writeback.rs +++ b/compiler/rustc_hir_typeck/src/writeback.rs @@ -248,13 +248,6 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { } } } - - fn visit_const_block(&mut self, span: Span, anon_const: &hir::ConstBlock) { - self.visit_node_id(span, anon_const.hir_id); - - let body = self.tcx().hir_body(anon_const.body); - self.visit_body(body); - } } /////////////////////////////////////////////////////////////////////////// @@ -284,9 +277,6 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> { hir::ExprKind::Field(..) | hir::ExprKind::OffsetOf(..) => { self.visit_field_id(e.hir_id); } - hir::ExprKind::ConstBlock(ref anon_const) => { - self.visit_const_block(e.span, anon_const); - } _ => {} } @@ -297,6 +287,14 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> { self.fix_index_builtin_expr(e); } + fn visit_inline_const(&mut self, anon_const: &hir::ConstBlock) { + let span = self.tcx().def_span(anon_const.def_id); + self.visit_node_id(span, anon_const.hir_id); + + let body = self.tcx().hir_body(anon_const.body); + self.visit_body(body); + } + fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) { match &p.kind { hir::GenericParamKind::Lifetime { .. } => { @@ -343,9 +341,6 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> { fn visit_pat_expr(&mut self, expr: &'tcx hir::PatExpr<'tcx>) { self.visit_node_id(expr.span, expr.hir_id); - if let hir::PatExprKind::ConstBlock(c) = &expr.kind { - self.visit_const_block(expr.span, c); - } intravisit::walk_pat_expr(self, expr); } |
