@@ -37,7 +37,9 @@ pub struct EarlyContextAndPasses<'a> {
3737}
3838
3939impl < ' 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 ) {
4143 for early_lint in self . context . buffered . take ( id) {
4244 let BufferedEarlyLint { span, msg, node_id : _, lint_id, diagnostic } = early_lint;
4345 self . context . lookup_with_diagnostics (
@@ -50,6 +52,11 @@ impl<'a> EarlyContextAndPasses<'a> {
5052 }
5153 }
5254
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+
5360 /// Merge the lints specified by any lint attributes into the
5461 /// current lint context, call the provided function, then reset the
5562 /// lints in effect to their previous state.
@@ -61,7 +68,7 @@ impl<'a> EarlyContextAndPasses<'a> {
6168 debug ! ( ?id) ;
6269 let push = self . context . builder . push ( attrs, is_crate_node, None ) ;
6370
64- self . check_id ( id) ;
71+ self . inlined_check_id ( id) ;
6572 debug ! ( "early context: enter_attrs({:?})" , attrs) ;
6673 run_early_passes ! ( self , enter_lint_attrs, attrs) ;
6774 f ( self ) ;
0 commit comments