File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -1042,11 +1042,20 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
1042
1042
// Put the lint store levels and passes back in the session.
1043
1043
cx. lint_sess . restore ( & sess. lint_store ) ;
1044
1044
1045
- // Emit all buffered lints from early on in the session now that we've
1046
- // calculated the lint levels for all AST nodes.
1047
- for ( _id, lints) in cx. buffered . map {
1048
- for early_lint in lints {
1049
- span_bug ! ( early_lint. span, "failed to process bufferd lint here" ) ;
1045
+ // All of the buffered lints should have been emitted at this point.
1046
+ // If not, that means that we somehow buffered a lint for a node id
1047
+ // that was not lint-checked (perhaps it doesn't exist?). This is a bug.
1048
+ //
1049
+ // Rustdoc runs everybody-loops before the early lints and removes
1050
+ // function bodies, so it's totally possible for linted
1051
+ // node ids to not exist (e.g. macros defined within functions for the
1052
+ // unused_macro lint) anymore. So we only run this check
1053
+ // when we're not in rustdoc mode. (see issue #47639)
1054
+ if !sess. opts . actually_rustdoc {
1055
+ for ( _id, lints) in cx. buffered . map {
1056
+ for early_lint in lints {
1057
+ span_bug ! ( early_lint. span, "failed to process buffered lint here" ) ;
1058
+ }
1050
1059
}
1051
1060
}
1052
1061
}
You can’t perform that action at this time.
0 commit comments