diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-06-14 00:48:52 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-06-14 18:58:23 +0300 |
| commit | f3f9d6dfd92dfaeb14df891ad27b2531809dd734 (patch) | |
| tree | cc6b503f85dcfa52dde1c95b52a35c3b94569a84 /src/librustc/dep_graph | |
| parent | 0e4a56b4b04ea98bb16caada30cb2418dd06e250 (diff) | |
| download | rust-f3f9d6dfd92dfaeb14df891ad27b2531809dd734.tar.gz rust-f3f9d6dfd92dfaeb14df891ad27b2531809dd734.zip | |
Unify all uses of 'gcx and 'tcx.
Diffstat (limited to 'src/librustc/dep_graph')
| -rw-r--r-- | src/librustc/dep_graph/dep_node.rs | 58 | ||||
| -rw-r--r-- | src/librustc/dep_graph/graph.rs | 10 | ||||
| -rw-r--r-- | src/librustc/dep_graph/safe.rs | 2 |
3 files changed, 35 insertions, 35 deletions
diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 82bba96dd4c..f7647167a75 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -204,10 +204,10 @@ macro_rules! define_dep_nodes { impl DepNode { #[allow(unreachable_code, non_snake_case)] #[inline(always)] - pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, - dep: DepConstructor<'gcx>) + pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx>, + dep: DepConstructor<'tcx>) -> DepNode - where 'gcx: 'a + 'tcx, + where 'tcx: 'a, 'tcx: 'a { match dep { @@ -307,7 +307,7 @@ macro_rules! define_dep_nodes { /// refers to something from the previous compilation session that /// has been removed. #[inline] - pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_>) -> Option<DefId> { + pub fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId> { if self.kind.can_reconstruct_query_key() { let def_path_hash = DefPathHash(self.hash); tcx.def_path_hash_to_def_id.as_ref()? @@ -400,7 +400,7 @@ impl DefPathHash { impl DefId { #[inline(always)] - pub fn to_dep_node(self, tcx: TyCtxt<'_, '_>, kind: DepKind) -> DepNode { + pub fn to_dep_node(self, tcx: TyCtxt<'_>, kind: DepKind) -> DepNode { DepNode::from_def_path_hash(kind, tcx.def_path_hash(self)) } } @@ -442,50 +442,50 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx> ]); pub trait RecoverKey<'tcx>: Sized { - fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self>; + fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>; } impl RecoverKey<'tcx> for CrateNum { - fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> { + fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> { dep_node.extract_def_id(tcx).map(|id| id.krate) } } impl RecoverKey<'tcx> for DefId { - fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> { + fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> { dep_node.extract_def_id(tcx) } } impl RecoverKey<'tcx> for DefIndex { - fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> { + fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> { dep_node.extract_def_id(tcx).map(|id| id.index) } } -trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug { +trait DepNodeParams<'tcx>: fmt::Debug { const CAN_RECONSTRUCT_QUERY_KEY: bool; /// This method turns the parameters of a DepNodeConstructor into an opaque /// Fingerprint to be used in DepNode. /// Not all DepNodeParams support being turned into a Fingerprint (they /// don't need to if the corresponding DepNode is anonymous). - fn to_fingerprint(&self, _: TyCtxt<'gcx, 'tcx>) -> Fingerprint { + fn to_fingerprint(&self, _: TyCtxt<'tcx>) -> Fingerprint { panic!("Not implemented. Accidentally called on anonymous node?") } - fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String { + fn to_debug_str(&self, _: TyCtxt<'tcx>) -> String { format!("{:?}", self) } } -impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T +impl<'tcx, T> DepNodeParams<'tcx> for T where T: HashStable<StableHashingContext<'tcx>> + fmt::Debug, { default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; - default fn to_fingerprint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Fingerprint { + default fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint { let mut hcx = tcx.create_stable_hashing_context(); let mut hasher = StableHasher::new(); @@ -494,39 +494,39 @@ where hasher.finish() } - default fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String { + default fn to_debug_str(&self, _: TyCtxt<'tcx>) -> String { format!("{:?}", *self) } } -impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId { +impl<'tcx> DepNodeParams<'tcx> for DefId { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint { tcx.def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { tcx.def_path_str(*self) } } -impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex { +impl<'tcx> DepNodeParams<'tcx> for DefIndex { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint { tcx.hir().definitions().def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { tcx.def_path_str(DefId::local(*self)) } } -impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum { +impl<'tcx> DepNodeParams<'tcx> for CrateNum { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint { let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX, @@ -534,18 +534,18 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum { tcx.def_path_hash(def_id).0 } - fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { tcx.crate_name(*self).as_str().to_string() } } -impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { +impl<'tcx> DepNodeParams<'tcx> for (DefId, DefId) { const CAN_RECONSTRUCT_QUERY_KEY: bool = false; // We actually would not need to specialize the implementation of this // method but it's faster to combine the hashes than to instantiate a full // hashing context and stable-hashing state. - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint { let (def_id_0, def_id_1) = *self; let def_path_hash_0 = tcx.def_path_hash(def_id_0); @@ -554,7 +554,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { def_path_hash_0.0.combine(def_path_hash_1.0) } - fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String { let (def_id_0, def_id_1) = *self; format!("({}, {})", @@ -563,13 +563,13 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { } } -impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId { +impl<'tcx> DepNodeParams<'tcx> for HirId { const CAN_RECONSTRUCT_QUERY_KEY: bool = false; // We actually would not need to specialize the implementation of this // method but it's faster to combine the hashes than to instantiate a full // hashing context and stable-hashing state. - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint { let HirId { owner, local_id, diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 40ccd6e7b28..c2e3c12cea8 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -557,7 +557,7 @@ impl DepGraph { /// a node index can be found for that node. pub fn try_mark_green_and_read( &self, - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, dep_node: &DepNode, ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| { @@ -569,7 +569,7 @@ impl DepGraph { pub fn try_mark_green( &self, - tcx: TyCtxt<'_, '_>, + tcx: TyCtxt<'_>, dep_node: &DepNode, ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { debug_assert!(!dep_node.kind.is_eval_always()); @@ -603,7 +603,7 @@ impl DepGraph { /// Try to mark a dep-node which existed in the previous compilation session as green. fn try_mark_previous_green<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, data: &DepGraphData, prev_dep_node_index: SerializedDepNodeIndex, dep_node: &DepNode, @@ -790,7 +790,7 @@ impl DepGraph { #[inline(never)] fn emit_diagnostics<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx>, + tcx: TyCtxt<'tcx>, data: &DepGraphData, dep_node_index: DepNodeIndex, did_allocation: bool, @@ -841,7 +841,7 @@ impl DepGraph { // // This method will only load queries that will end up in the disk cache. // Other queries will not be executed. - pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) { + pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx>) { let green_nodes: Vec<DepNode> = { let data = self.data.as_ref().unwrap(); data.colors.values.indices().filter_map(|prev_index| { diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index 62667c957cd..e5eda14cdbe 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -33,7 +33,7 @@ impl DepGraphSafe for DefId { /// The type context itself can be used to access all kinds of tracked /// state, but those accesses should always generate read events. -impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {} +impl<'tcx> DepGraphSafe for TyCtxt<'tcx> {} /// Tuples make it easy to build up state. impl<A, B> DepGraphSafe for (A, B) |
