Skip to content

Commit 6e4adbe

Browse files
committed
Remove visit_const_block in typeck writeback
There is a `visit_inline_const` visitor method and it is used instead.
1 parent 2af87ea commit 6e4adbe

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

compiler/rustc_hir_typeck/src/writeback.rs

+8-13
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,6 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
248248
}
249249
}
250250
}
251-
252-
fn visit_const_block(&mut self, span: Span, anon_const: &hir::ConstBlock) {
253-
self.visit_node_id(span, anon_const.hir_id);
254-
255-
let body = self.tcx().hir_body(anon_const.body);
256-
self.visit_body(body);
257-
}
258251
}
259252

260253
///////////////////////////////////////////////////////////////////////////
@@ -284,9 +277,6 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
284277
hir::ExprKind::Field(..) | hir::ExprKind::OffsetOf(..) => {
285278
self.visit_field_id(e.hir_id);
286279
}
287-
hir::ExprKind::ConstBlock(ref anon_const) => {
288-
self.visit_const_block(e.span, anon_const);
289-
}
290280
_ => {}
291281
}
292282

@@ -297,6 +287,14 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
297287
self.fix_index_builtin_expr(e);
298288
}
299289

290+
fn visit_inline_const(&mut self, anon_const: &hir::ConstBlock) {
291+
let span = self.tcx().def_span(anon_const.def_id);
292+
self.visit_node_id(span, anon_const.hir_id);
293+
294+
let body = self.tcx().hir_body(anon_const.body);
295+
self.visit_body(body);
296+
}
297+
300298
fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) {
301299
match &p.kind {
302300
hir::GenericParamKind::Lifetime { .. } => {
@@ -343,9 +341,6 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
343341

344342
fn visit_pat_expr(&mut self, expr: &'tcx hir::PatExpr<'tcx>) {
345343
self.visit_node_id(expr.span, expr.hir_id);
346-
if let hir::PatExprKind::ConstBlock(c) = &expr.kind {
347-
self.visit_const_block(expr.span, c);
348-
}
349344
intravisit::walk_pat_expr(self, expr);
350345
}
351346

0 commit comments

Comments
 (0)