Skip to content

Commit bdf1f6e

Browse files
authored
Unrolled build for rust-lang#132107
Rollup merge of rust-lang#132107 - maxcabrajac:remove_expr_post, r=petrochenkov Remove visit_expr_post from ast Visitor `visit_expr_post` is only present in the immutable version of ast Visitors and its default implementation is a noop. Given that its only implementer is on `rustc_lint/src/early.rs` and its name follows the same naming convention as some other lints (`_post`), it seems that `visit_expr_post` being in `Visitor` was a little mistake. r? `@petrochenkov` related to rust-lang#128974
2 parents 1d4a767 + 0635916 commit bdf1f6e

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

compiler/rustc_ast/src/visit.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ pub trait Visitor<'ast>: Sized {
173173
fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) -> Self::Result {
174174
self.visit_expr(ex)
175175
}
176-
fn visit_expr_post(&mut self, _ex: &'ast Expr) -> Self::Result {
177-
Self::Result::output()
178-
}
179176
fn visit_ty(&mut self, t: &'ast Ty) -> Self::Result {
180177
walk_ty(self, t)
181178
}
@@ -1185,7 +1182,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V
11851182
ExprKind::Dummy => {}
11861183
}
11871184

1188-
visitor.visit_expr_post(expression)
1185+
V::Result::output()
11891186
}
11901187

11911188
pub fn walk_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a Param) -> V::Result {

compiler/rustc_lint/src/early.rs

+12-15
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
121121
self.with_lint_attrs(e.id, &e.attrs, |cx| {
122122
lint_callback!(cx, check_expr, e);
123123
ast_visit::walk_expr(cx, e);
124+
// Explicitly check for lints associated with 'closure_id', since
125+
// it does not have a corresponding AST node
126+
match e.kind {
127+
ast::ExprKind::Closure(box ast::Closure {
128+
coroutine_kind: Some(coroutine_kind),
129+
..
130+
}) => {
131+
cx.check_id(coroutine_kind.closure_id());
132+
}
133+
_ => {}
134+
}
135+
lint_callback!(cx, check_expr_post, e);
124136
})
125137
}
126138

@@ -214,21 +226,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
214226
})
215227
}
216228

217-
fn visit_expr_post(&mut self, e: &'a ast::Expr) {
218-
// Explicitly check for lints associated with 'closure_id', since
219-
// it does not have a corresponding AST node
220-
match e.kind {
221-
ast::ExprKind::Closure(box ast::Closure {
222-
coroutine_kind: Some(coroutine_kind),
223-
..
224-
}) => {
225-
self.check_id(coroutine_kind.closure_id());
226-
}
227-
_ => {}
228-
}
229-
lint_callback!(self, check_expr_post, e);
230-
}
231-
232229
fn visit_generic_arg(&mut self, arg: &'a ast::GenericArg) {
233230
lint_callback!(self, check_generic_arg, arg);
234231
ast_visit::walk_generic_arg(self, arg);

0 commit comments

Comments
 (0)