diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-02-27 05:56:48 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-03-12 09:55:35 +0100 |
| commit | 8dd0f20ee65883d12775ae4d552596b815ac9977 (patch) | |
| tree | 11d485dfd7e9e5abe02ef2f72b95d94f1db9b80c /compiler/rustc_query_system/src/dep_graph/mod.rs | |
| parent | 501ad021b9a4fb2cd6a39e0302d22f169f6166b0 (diff) | |
| download | rust-8dd0f20ee65883d12775ae4d552596b815ac9977.tar.gz rust-8dd0f20ee65883d12775ae4d552596b815ac9977.zip | |
Optimize dep node backtrace and ignore fatal errors
Diffstat (limited to 'compiler/rustc_query_system/src/dep_graph/mod.rs')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/mod.rs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/mod.rs b/compiler/rustc_query_system/src/dep_graph/mod.rs index 5a7b9ae2ab4..f70a9139743 100644 --- a/compiler/rustc_query_system/src/dep_graph/mod.rs +++ b/compiler/rustc_query_system/src/dep_graph/mod.rs @@ -17,8 +17,10 @@ use rustc_data_structures::profiling::SelfProfilerRef; use rustc_serialize::{opaque::FileEncoder, Encodable}; use rustc_session::Session; -use std::fmt; use std::hash::Hash; +use std::{fmt, panic}; + +use self::graph::{print_markframe_trace, DepGraphData, MarkFrame}; pub trait DepContext: Copy { type DepKind: self::DepKind; @@ -53,11 +55,24 @@ pub trait DepContext: Copy { } /// Try to force a dep node to execute and see if it's green. - #[instrument(skip(self), level = "debug")] - fn try_force_from_dep_node(self, dep_node: DepNode<Self::DepKind>) -> bool { + #[inline] + #[instrument(skip(self, graph, frame), level = "debug")] + fn try_force_from_dep_node( + self, + dep_node: DepNode<Self::DepKind>, + graph: &DepGraphData<Self::DepKind>, + frame: Option<&MarkFrame<'_>>, + ) -> bool { let cb = self.dep_kind_info(dep_node.kind); if let Some(f) = cb.force_from_dep_node { - f(self, dep_node); + if let Err(value) = panic::catch_unwind(panic::AssertUnwindSafe(|| { + f(self, dep_node); + })) { + if !value.is::<rustc_errors::FatalErrorMarker>() { + print_markframe_trace(graph, frame); + } + panic::resume_unwind(value) + } true } else { false |
