File tree 2 files changed +30
-5
lines changed
2 files changed +30
-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
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // This should not ICE
12
+ pub fn test ( ) {
13
+ macro_rules! foo {
14
+ ( ) => ( )
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments