2016-05-06 09:02:05 +00:00
|
|
|
pub mod debug;
|
2016-03-28 21:37:34 +00:00
|
|
|
mod dep_node;
|
|
|
|
mod graph;
|
2017-09-22 11:00:42 +00:00
|
|
|
mod prev;
|
2016-01-05 18:02:57 +00:00
|
|
|
mod query;
|
2017-09-22 11:00:42 +00:00
|
|
|
mod serialized;
|
2016-01-05 18:02:57 +00:00
|
|
|
|
2020-03-18 09:25:22 +00:00
|
|
|
pub use dep_node::{DepNode, DepNodeParams, WorkProductId};
|
|
|
|
pub use graph::{hash_result, DepGraph, DepNodeColor, DepNodeIndex, TaskDeps, WorkProduct};
|
|
|
|
pub use prev::PreviousDepGraph;
|
|
|
|
pub use query::DepGraphQuery;
|
|
|
|
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;
|
|
|
|
|
2020-03-24 19:09:06 +00:00
|
|
|
pub trait DepContext: Copy {
|
2020-03-18 09:25:22 +00:00
|
|
|
type DepKind: self::DepKind;
|
2020-03-27 07:33:37 +00:00
|
|
|
type StableHashingContext;
|
2020-03-18 09:25:22 +00:00
|
|
|
|
|
|
|
/// Create a hashing context for hashing new results.
|
|
|
|
fn create_stable_hashing_context(&self) -> Self::StableHashingContext;
|
|
|
|
|
2020-03-27 06:50:28 +00:00
|
|
|
fn debug_dep_tasks(&self) -> bool;
|
2020-03-28 12:51:37 +00:00
|
|
|
fn debug_dep_node(&self) -> bool;
|
2020-03-27 06:50:28 +00:00
|
|
|
|
2020-03-20 23:21:57 +00:00
|
|
|
/// Try to force a dep node to execute and see if it's green.
|
2020-03-22 19:47:30 +00:00
|
|
|
fn try_force_from_dep_node(&self, dep_node: &DepNode<Self::DepKind>) -> bool;
|
2020-03-18 09:25:22 +00:00
|
|
|
|
2020-12-19 00:00:52 +00:00
|
|
|
fn register_reused_dep_node(&self, dep_node: &DepNode<Self::DepKind>);
|
2020-07-29 16:26:15 +00:00
|
|
|
|
2020-03-18 09:25:22 +00:00
|
|
|
/// 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 data from the on-disk cache.
|
|
|
|
fn try_load_from_on_disk_cache(&self, dep_node: &DepNode<Self::DepKind>);
|
|
|
|
|
|
|
|
/// 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>);
|
2020-03-19 17:31:17 +00:00
|
|
|
|
|
|
|
/// Register diagnostics for the given node, for use in next session.
|
2020-03-26 08:40:50 +00:00
|
|
|
fn store_diagnostics_for_anon_node(
|
|
|
|
&self,
|
|
|
|
dep_node_index: DepNodeIndex,
|
|
|
|
diagnostics: ThinVec<Diagnostic>,
|
|
|
|
);
|
2020-03-18 09:25:22 +00:00
|
|
|
|
|
|
|
/// Access the profiler.
|
|
|
|
fn profiler(&self) -> &SelfProfilerRef;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Describe the different families of dependency nodes.
|
|
|
|
pub trait DepKind: Copy + fmt::Debug + Eq + Ord + Hash {
|
2020-03-18 20:02:02 +00:00
|
|
|
const NULL: Self;
|
|
|
|
|
2020-03-18 09:25:22 +00:00
|
|
|
/// Return whether this kind always require evaluation.
|
|
|
|
fn is_eval_always(&self) -> bool;
|
|
|
|
|
|
|
|
/// Return whether this kind requires additional parameters to be executed.
|
|
|
|
fn has_params(&self) -> bool;
|
|
|
|
|
|
|
|
/// Implementation of `std::fmt::Debug` for `DepNode`.
|
|
|
|
fn debug_node(node: &DepNode<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result;
|
|
|
|
|
|
|
|
/// Execute the operation with provided dependencies.
|
|
|
|
fn with_deps<OP, R>(deps: Option<&Lock<TaskDeps<Self>>>, op: OP) -> R
|
|
|
|
where
|
|
|
|
OP: FnOnce() -> R;
|
|
|
|
|
|
|
|
/// Access dependencies from current implicit context.
|
Fix clippy warnings
Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}
2020-05-11 11:01:37 +00:00
|
|
|
fn read_deps<OP>(op: OP)
|
2020-03-18 09:25:22 +00:00
|
|
|
where
|
Fix clippy warnings
Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}
2020-05-11 11:01:37 +00:00
|
|
|
OP: for<'a> FnOnce(Option<&'a Lock<TaskDeps<Self>>>);
|
2020-03-18 20:02:02 +00:00
|
|
|
|
|
|
|
fn can_reconstruct_query_key(&self) -> bool;
|
2020-03-18 09:25:22 +00:00
|
|
|
}
|