Skip to content

Commit 4fb7bc5

Browse files
committed
Allow for try_force_from_dep_node to fail
The way it is implemented currently try_force_from_dep_node returns true as long as there's a function to force the query. It wasn't this way from the beginning, earlier version was producing forcing result and it was changed in rust-lang#89978, I couldn't find any comments addressing this change. One way it can fail is by failing to recover the query in DepNodeParams::recover - when we are trying to query something that no longer exists in the current environment
1 parent 921645c commit 4fb7bc5

File tree

1 file changed

+7
-7
lines changed
  • compiler/rustc_query_system/src/dep_graph

1 file changed

+7
-7
lines changed

compiler/rustc_query_system/src/dep_graph/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ pub trait DepContext: Copy {
5656
fn try_force_from_dep_node(self, dep_node: DepNode, frame: Option<&MarkFrame<'_>>) -> bool {
5757
let cb = self.dep_kind_info(dep_node.kind);
5858
if let Some(f) = cb.force_from_dep_node {
59-
if let Err(value) = panic::catch_unwind(panic::AssertUnwindSafe(|| {
60-
f(self, dep_node);
61-
})) {
62-
if !value.is::<rustc_errors::FatalErrorMarker>() {
63-
print_markframe_trace(self.dep_graph(), frame);
59+
match panic::catch_unwind(panic::AssertUnwindSafe(|| f(self, dep_node))) {
60+
Err(value) => {
61+
if !value.is::<rustc_errors::FatalErrorMarker>() {
62+
print_markframe_trace(self.dep_graph(), frame);
63+
}
64+
panic::resume_unwind(value)
6465
}
65-
panic::resume_unwind(value)
66+
Ok(val) => val,
6667
}
67-
true
6868
} else {
6969
false
7070
}

0 commit comments

Comments
 (0)