@@ -37,7 +37,9 @@ pub struct EarlyContextAndPasses<'a> {
37
37
}
38
38
39
39
impl<'a> EarlyContextAndPasses<'a> {
40
- fn check_id(&mut self, id: ast::NodeId) {
40
+ // This always-inlined function is for the hot call site.
41
+ #[inline(always)]
42
+ fn inlined_check_id(&mut self, id: ast::NodeId) {
41
43
for early_lint in self.context.buffered.take(id) {
42
44
let BufferedEarlyLint { span, msg, node_id: _, lint_id, diagnostic } = early_lint;
43
45
self.context.lookup_with_diagnostics(
@@ -50,6 +52,11 @@ impl<'a> EarlyContextAndPasses<'a> {
50
52
}
51
53
}
52
54
55
+ // This non-inlined function is for the cold call sites.
56
+ fn check_id(&mut self, id: ast::NodeId) {
57
+ self.inlined_check_id(id)
58
+ }
59
+
53
60
/// Merge the lints specified by any lint attributes into the
54
61
/// current lint context, call the provided function, then reset the
55
62
/// lints in effect to their previous state.
@@ -61,7 +68,7 @@ impl<'a> EarlyContextAndPasses<'a> {
61
68
debug!(?id);
62
69
let push = self.context.builder.push(attrs, is_crate_node, None);
63
70
64
- self.check_id (id);
71
+ self.inlined_check_id (id);
65
72
debug!("early context: enter_attrs({:?})", attrs);
66
73
run_early_passes!(self, enter_lint_attrs, attrs);
67
74
f(self);
0 commit comments