about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-10-11 09:31:43 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-10-13 06:35:19 +1100
commitb65227a9ee38cd21e0b4ffbec7542d2638b661a2 (patch)
tree9931ee46adc43ce43dd2e1159563c8556b9c381c
parentba58e3213db9626381f5fd014e569f7d2335fa03 (diff)
downloadrust-b65227a9ee38cd21e0b4ffbec7542d2638b661a2.tar.gz
rust-b65227a9ee38cd21e0b4ffbec7542d2638b661a2.zip
Make `needs_analysis` true for `PpHirMode::Typed`.
This avoids the need for a bespoke `tcx.analysis()` call.
-rw-r--r--compiler/rustc_driver_impl/src/pretty.rs1
-rw-r--r--compiler/rustc_session/src/config.rs2
2 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_driver_impl/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs
index daba78612f5..87e3af2f9d9 100644
--- a/compiler/rustc_driver_impl/src/pretty.rs
+++ b/compiler/rustc_driver_impl/src/pretty.rs
@@ -297,7 +297,6 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
                     f(&annotation)
                 }
                 PpHirMode::Typed => {
-                    abort_on_err(tcx.analysis(()), tcx.sess);
                     let annotation = TypedAnnotation { tcx, maybe_typeck_results: Cell::new(None) };
                     tcx.dep_graph.with_ignore(|| f(&annotation))
                 }
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 056986a8144..2a6f5994c49 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -3144,7 +3144,7 @@ impl PpMode {
 
     pub fn needs_analysis(&self) -> bool {
         use PpMode::*;
-        matches!(*self, Mir | MirCFG | ThirTree | ThirFlat)
+        matches!(*self, Hir(PpHirMode::Typed) | Mir | MirCFG | ThirTree | ThirFlat)
     }
 }