Split EarlyContextAndPasses::check_id
in two.
This commit is contained in:
parent
b08fd6e8ef
commit
d049be30cf
1 changed files with 9 additions and 2 deletions
|
@ -37,7 +37,9 @@ pub struct EarlyContextAndPasses<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> EarlyContextAndPasses<'a> {
|
impl<'a> EarlyContextAndPasses<'a> {
|
||||||
fn check_id(&mut self, id: ast::NodeId) {
|
// This always-inlined function is for the hot call site.
|
||||||
|
#[inline(always)]
|
||||||
|
fn inlined_check_id(&mut self, id: ast::NodeId) {
|
||||||
for early_lint in self.context.buffered.take(id) {
|
for early_lint in self.context.buffered.take(id) {
|
||||||
let BufferedEarlyLint { span, msg, node_id: _, lint_id, diagnostic } = early_lint;
|
let BufferedEarlyLint { span, msg, node_id: _, lint_id, diagnostic } = early_lint;
|
||||||
self.context.lookup_with_diagnostics(
|
self.context.lookup_with_diagnostics(
|
||||||
|
@ -50,6 +52,11 @@ impl<'a> EarlyContextAndPasses<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This non-inlined function is for the cold call sites.
|
||||||
|
fn check_id(&mut self, id: ast::NodeId) {
|
||||||
|
self.inlined_check_id(id)
|
||||||
|
}
|
||||||
|
|
||||||
/// Merge the lints specified by any lint attributes into the
|
/// Merge the lints specified by any lint attributes into the
|
||||||
/// current lint context, call the provided function, then reset the
|
/// current lint context, call the provided function, then reset the
|
||||||
/// lints in effect to their previous state.
|
/// lints in effect to their previous state.
|
||||||
|
@ -61,7 +68,7 @@ impl<'a> EarlyContextAndPasses<'a> {
|
||||||
debug!(?id);
|
debug!(?id);
|
||||||
let push = self.context.builder.push(attrs, is_crate_node, None);
|
let push = self.context.builder.push(attrs, is_crate_node, None);
|
||||||
|
|
||||||
self.check_id(id);
|
self.inlined_check_id(id);
|
||||||
debug!("early context: enter_attrs({:?})", attrs);
|
debug!("early context: enter_attrs({:?})", attrs);
|
||||||
run_early_passes!(self, enter_lint_attrs, attrs);
|
run_early_passes!(self, enter_lint_attrs, attrs);
|
||||||
f(self);
|
f(self);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue