Use a QueryContext for try_mark_green.
This commit is contained in:
parent
3bd14c7bbe
commit
b27266fdb2
10 changed files with 133 additions and 143 deletions
|
@ -587,7 +587,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
/// A node will have an index, when it's already been marked green, or when we can mark it
|
||||
/// green. This function will mark the current task as a reader of the specified node, when
|
||||
/// a node index can be found for that node.
|
||||
pub fn try_mark_green_and_read<Ctxt: DepContext<DepKind = K>>(
|
||||
pub fn try_mark_green_and_read<Ctxt: QueryContext<DepKind = K>>(
|
||||
&self,
|
||||
tcx: Ctxt,
|
||||
dep_node: &DepNode<K>,
|
||||
|
@ -599,7 +599,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn try_mark_green<Ctxt: DepContext<DepKind = K>>(
|
||||
pub fn try_mark_green<Ctxt: QueryContext<DepKind = K>>(
|
||||
&self,
|
||||
tcx: Ctxt,
|
||||
dep_node: &DepNode<K>,
|
||||
|
@ -627,7 +627,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
}
|
||||
|
||||
/// Try to mark a dep-node which existed in the previous compilation session as green.
|
||||
fn try_mark_previous_green<Ctxt: DepContext<DepKind = K>>(
|
||||
fn try_mark_previous_green<Ctxt: QueryContext<DepKind = K>>(
|
||||
&self,
|
||||
tcx: Ctxt,
|
||||
data: &DepGraphData<K>,
|
||||
|
@ -811,7 +811,7 @@ impl<K: DepKind> DepGraph<K> {
|
|||
/// This may be called concurrently on multiple threads for the same dep node.
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
fn emit_diagnostics<Ctxt: DepContext<DepKind = K>>(
|
||||
fn emit_diagnostics<Ctxt: QueryContext<DepKind = K>>(
|
||||
&self,
|
||||
tcx: Ctxt,
|
||||
data: &DepGraphData<K>,
|
||||
|
|
|
@ -13,8 +13,6 @@ pub use serialized::{SerializedDepGraph, SerializedDepNodeIndex};
|
|||
|
||||
use rustc_data_structures::profiling::SelfProfilerRef;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_errors::Diagnostic;
|
||||
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
|
@ -32,30 +30,8 @@ pub trait DepContext: Copy {
|
|||
/// Access the DepGraph.
|
||||
fn dep_graph(&self) -> &DepGraph<Self::DepKind>;
|
||||
|
||||
/// Try to force a dep node to execute and see if it's green.
|
||||
fn try_force_from_dep_node(&self, dep_node: &DepNode<Self::DepKind>) -> bool;
|
||||
|
||||
fn register_reused_dep_node(&self, dep_node: &DepNode<Self::DepKind>);
|
||||
|
||||
/// Return whether the current session is tainted by errors.
|
||||
fn has_errors_or_delayed_span_bugs(&self) -> bool;
|
||||
|
||||
/// Return the diagnostic handler.
|
||||
fn diagnostic(&self) -> &rustc_errors::Handler;
|
||||
|
||||
/// Load diagnostics associated to the node in the previous session.
|
||||
fn load_diagnostics(&self, prev_dep_node_index: SerializedDepNodeIndex) -> Vec<Diagnostic>;
|
||||
|
||||
/// Register diagnostics for the given node, for use in next session.
|
||||
fn store_diagnostics(&self, dep_node_index: DepNodeIndex, diagnostics: ThinVec<Diagnostic>);
|
||||
|
||||
/// Register diagnostics for the given node, for use in next session.
|
||||
fn store_diagnostics_for_anon_node(
|
||||
&self,
|
||||
dep_node_index: DepNodeIndex,
|
||||
diagnostics: ThinVec<Diagnostic>,
|
||||
);
|
||||
|
||||
/// Access the profiler.
|
||||
fn profiler(&self) -> &SelfProfilerRef;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue