Remove graph parameter from try_force_from_dep_node

This commit is contained in:
John Kåre Alsaker 2023-03-09 08:35:01 +01:00
parent 8dd0f20ee6
commit 867de8bbb8
2 changed files with 8 additions and 7 deletions

View File

@ -776,7 +776,7 @@ impl<K: DepKind> DepGraphData<K> {
// We failed to mark it green, so we try to force the query.
debug!("trying to force dependency {dep_dep_node:?}");
if !qcx.dep_context().try_force_from_dep_node(*dep_dep_node, data, frame) {
if !qcx.dep_context().try_force_from_dep_node(*dep_dep_node, frame) {
// The DepNode could not be forced.
debug!("dependency {dep_dep_node:?} could not be forced");
return None;
@ -1416,9 +1416,11 @@ impl DepNodeColorMap {
#[inline(never)]
#[cold]
pub(crate) fn print_markframe_trace<K: DepKind>(
graph: &DepGraphData<K>,
graph: &DepGraph<K>,
frame: Option<&MarkFrame<'_>>,
) {
let data = graph.data.as_ref().unwrap();
eprintln!("there was a panic while trying to force a dep node");
eprintln!("try_mark_green dep node stack:");
@ -1426,7 +1428,7 @@ pub(crate) fn print_markframe_trace<K: DepKind>(
let mut current = frame;
while let Some(frame) = current {
// Do not try to rely on DepNode's Debug implementation, since it may panic.
let node = graph.previous.index_to_node(frame.index);
let node = data.previous.index_to_node(frame.index);
eprintln!("#{i} {:?} ({})", node.kind, node.hash);
current = frame.parent;
i += 1;

View File

@ -20,7 +20,7 @@ use rustc_session::Session;
use std::hash::Hash;
use std::{fmt, panic};
use self::graph::{print_markframe_trace, DepGraphData, MarkFrame};
use self::graph::{print_markframe_trace, MarkFrame};
pub trait DepContext: Copy {
type DepKind: self::DepKind;
@ -56,11 +56,10 @@ pub trait DepContext: Copy {
/// Try to force a dep node to execute and see if it's green.
#[inline]
#[instrument(skip(self, graph, frame), level = "debug")]
#[instrument(skip(self, 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);
@ -69,7 +68,7 @@ pub trait DepContext: Copy {
f(self, dep_node);
})) {
if !value.is::<rustc_errors::FatalErrorMarker>() {
print_markframe_trace(graph, frame);
print_markframe_trace(self.dep_graph(), frame);
}
panic::resume_unwind(value)
}