diff options
| author | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-10-03 21:04:36 +0200 |
|---|---|---|
| committer | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-10-03 21:04:36 +0200 |
| commit | a28a78f247a0f02521e97eabf98e790085a4a753 (patch) | |
| tree | 41ec731aab5228325a9e83f44d1a8d63626d58a6 /compiler/rustc_interface | |
| parent | edebf77e0090195bf80c0d8cda821e1bf9d03053 (diff) | |
| download | rust-a28a78f247a0f02521e97eabf98e790085a4a753.tar.gz rust-a28a78f247a0f02521e97eabf98e790085a4a753.zip | |
Fix ICE with buffered lint referring to AST node deleted by everybody_loops
Diffstat (limited to 'compiler/rustc_interface')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index a221746f975..2d12ea94a0b 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -437,12 +437,18 @@ pub fn configure_and_expand( }); // Add all buffered lints from the `ParseSess` to the `Session`. - sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { - info!("{} parse sess buffered_lints", buffered_lints.len()); - for early_lint in buffered_lints.drain(..) { - resolver.lint_buffer().add_early_lint(early_lint); - } - }); + // The ReplaceBodyWithLoop pass may have deleted some AST nodes, potentially + // causing a delay_span_bug later if a buffered lint refers to such a deleted + // AST node (issue #87308). Since everybody_loops is for pretty-printing only, + // anyway, we simply skip all buffered lints here. + if !matches!(sess.opts.pretty, Some(PpMode::Source(PpSourceMode::EveryBodyLoops))) { + sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { + info!("{} parse sess buffered_lints", buffered_lints.len()); + for early_lint in buffered_lints.drain(..) { + resolver.lint_buffer().add_early_lint(early_lint); + } + }); + } Ok(krate) } |
