Skip to content

Commit 73e31b9

Browse files
committed
Auto merge of #142398 - fee1-dead-contrib:push-ynxrtswtkyxw, r=<try>
early linting: avoid redundant calls to `check_id` An attempt to address the regression at #142240 (comment) r? `@oli-obk` cc `@nnethercote` who might have a better understanding of the performance implications
2 parents 1434630 + ac92e87 commit 73e31b9

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

compiler/rustc_lint/src/early.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ pub struct EarlyContextAndPass<'ecx, 'tcx, T: EarlyLintPass> {
3333
}
3434

3535
impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> {
36-
// This always-inlined function is for the hot call site.
37-
#[inline(always)]
3836
#[allow(rustc::diagnostic_outside_of_impl)]
39-
fn inlined_check_id(&mut self, id: ast::NodeId) {
37+
fn check_id(&mut self, id: ast::NodeId) {
4038
for early_lint in self.context.buffered.take(id) {
4139
let BufferedEarlyLint { span, node_id: _, lint_id, diagnostic } = early_lint;
4240
self.context.opt_span_lint(lint_id.lint, span, |diag| {
@@ -45,11 +43,6 @@ impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> {
4543
}
4644
}
4745

48-
// This non-inlined function is for the cold call sites.
49-
fn check_id(&mut self, id: ast::NodeId) {
50-
self.inlined_check_id(id)
51-
}
52-
5346
/// Merge the lints specified by any lint attributes into the
5447
/// current lint context, call the provided function, then reset the
5548
/// lints in effect to their previous state.
@@ -61,7 +54,6 @@ impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> {
6154
debug!(?id);
6255
let push = self.context.builder.push(attrs, is_crate_node, None);
6356

64-
self.inlined_check_id(id);
6557
debug!("early context: enter_attrs({:?})", attrs);
6658
lint_callback!(self, check_attributes, attrs);
6759
ensure_sufficient_stack(|| f(self));

0 commit comments

Comments
 (0)