File tree 3 files changed +38
-6
lines changed
compiler/rustc_interface/src
3 files changed +38
-6
lines changed Original file line number Diff line number Diff line change @@ -437,12 +437,18 @@ pub fn configure_and_expand(
437
437
} ) ;
438
438
439
439
// Add all buffered lints from the `ParseSess` to the `Session`.
440
- sess. parse_sess . buffered_lints . with_lock ( |buffered_lints| {
441
- info ! ( "{} parse sess buffered_lints" , buffered_lints. len( ) ) ;
442
- for early_lint in buffered_lints. drain ( ..) {
443
- resolver. lint_buffer ( ) . add_early_lint ( early_lint) ;
444
- }
445
- } ) ;
440
+ // The ReplaceBodyWithLoop pass may have deleted some AST nodes, potentially
441
+ // causing a delay_span_bug later if a buffered lint refers to such a deleted
442
+ // AST node (issue #87308). Since everybody_loops is for pretty-printing only,
443
+ // anyway, we simply skip all buffered lints here.
444
+ if !matches ! ( sess. opts. pretty, Some ( PpMode :: Source ( PpSourceMode :: EveryBodyLoops ) ) ) {
445
+ sess. parse_sess . buffered_lints . with_lock ( |buffered_lints| {
446
+ info ! ( "{} parse sess buffered_lints" , buffered_lints. len( ) ) ;
447
+ for early_lint in buffered_lints. drain ( ..) {
448
+ resolver. lint_buffer ( ) . add_early_lint ( early_lint) ;
449
+ }
450
+ } ) ;
451
+ }
446
452
447
453
Ok ( krate)
448
454
}
Original file line number Diff line number Diff line change
1
+ // Regression test for issue #87308.
2
+
3
+ // compile-flags: -Zunpretty=everybody_loops
4
+ // check-pass
5
+
6
+ macro_rules! foo {
7
+ ( ) => { break ' x; }
8
+ }
9
+
10
+ pub fn main ( ) {
11
+ ' x: loop { foo ! ( ) }
12
+ }
Original file line number Diff line number Diff line change
1
+ #![feature(prelude_import)]
2
+ #![no_std]
3
+ #[prelude_import]
4
+ use ::std::prelude::rust_2015::*;
5
+ #[macro_use]
6
+ extern crate std;
7
+ // Regression test for issue #87308.
8
+
9
+ // compile-flags: -Zunpretty=everybody_loops
10
+ // check-pass
11
+
12
+ macro_rules! foo { () => { break 'x ; } }
13
+
14
+ pub fn main() { loop { } }
You can’t perform that action at this time.
0 commit comments