Skip to content

Commit 2326ae3

Browse files
committed
Merge ensure_node_can_be_forced into force_from_dep_node.
1 parent db7bd5f commit 2326ae3

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

src/librustc/dep_graph/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
110110
TyCtxt::create_stable_hashing_context(*self)
111111
}
112112

113-
fn force_from_dep_node(&self, node: &DepNode) -> bool {
114-
ty::query::force_from_dep_node(*self, node)
115-
}
116-
117113
/// Extracts the DefId corresponding to this DepNode. This will work
118114
/// if two conditions are met:
119115
///
@@ -133,7 +129,7 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
133129
}
134130
}
135131

136-
fn ensure_node_can_be_forced(&self, dep_dep_node: &DepNode) -> Option<()> {
132+
fn try_force_previous_green(&self, dep_dep_node: &DepNode) -> bool {
137133
// FIXME: This match is just a workaround for incremental bugs and should
138134
// be removed. https://github.com/rust-lang/rust/issues/62649 is one such
139135
// bug that must be fixed before removing this.
@@ -162,20 +158,22 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
162158
// Since the given `DefPath` does not
163159
// denote the item that previously
164160
// existed, we just fail to mark green.
165-
return None;
161+
return false;
166162
}
167163
} else {
168164
// If the node does not exist anymore, we
169165
// just fail to mark green.
170-
return None;
166+
return false;
171167
}
172168
}
173169
_ => {
174170
// For other kinds of nodes it's OK to be
175171
// forced.
176172
}
177173
}
178-
Some(())
174+
175+
debug!("try_force_previous_green({:?}) --- trying to force", dep_dep_node);
176+
ty::query::force_from_dep_node(*self, dep_dep_node)
179177
}
180178

181179
fn has_errors_or_delayed_span_bugs(&self) -> bool {

src/librustc_query_system/dep_graph/graph.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,6 @@ impl<K: DepKind> DepGraph<K> {
635635
current_deps.push(node_index);
636636
continue;
637637
}
638-
} else {
639-
tcx.ensure_node_can_be_forced(dep_dep_node)?;
640638
}
641639

642640
// We failed to mark it green, so we try to force the query.
@@ -645,7 +643,7 @@ impl<K: DepKind> DepGraph<K> {
645643
dependency {:?}",
646644
dep_node, dep_dep_node
647645
);
648-
if tcx.force_from_dep_node(dep_dep_node) {
646+
if tcx.try_force_previous_green(dep_dep_node) {
649647
let dep_dep_node_color = data.colors.get(dep_dep_node_index);
650648

651649
match dep_dep_node_color {

src/librustc_query_system/dep_graph/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ pub trait DepContext: Copy {
3131
/// Create a hashing context for hashing new results.
3232
fn create_stable_hashing_context(&self) -> Self::StableHashingContext;
3333

34-
/// Force the execution of a query given the associated `DepNode`.
35-
fn force_from_dep_node(&self, node: &DepNode<Self::DepKind>) -> bool;
34+
/// Try to force a dep node to execute and see if it's green.
35+
fn try_force_previous_green(&self, node: &DepNode<Self::DepKind>) -> bool;
3636

3737
/// Extracts the DefId corresponding to this DepNode. This will work
3838
/// if two conditions are met:
@@ -46,9 +46,6 @@ pub trait DepContext: Copy {
4646
/// has been removed.
4747
fn extract_def_id(&self, node: &DepNode<Self::DepKind>) -> Option<DefId>;
4848

49-
/// Check the legality of forcing this node.
50-
fn ensure_node_can_be_forced(&self, dep_dep_node: &DepNode<Self::DepKind>) -> Option<()>;
51-
5249
/// Return whether the current session is tainted by errors.
5350
fn has_errors_or_delayed_span_bugs(&self) -> bool;
5451

0 commit comments

Comments
 (0)