Skip to content

Commit 414be2e

Browse files
committed
Remove Deps.
It's no longer needed.
1 parent 1d83208 commit 414be2e

4 files changed

Lines changed: 24 additions & 51 deletions

File tree

compiler/rustc_middle/src/dep_graph/graph.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use {super::debug::EdgeFilter, std::env};
2525

2626
use super::query::DepGraphQuery;
2727
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};
28-
use super::{DepContext, DepKind, DepNode, Deps, DepsType, HasDepContext, WorkProductId};
28+
use super::{DepContext, DepKind, DepNode, DepsType, HasDepContext, WorkProductId};
2929
use crate::dep_graph::edges::EdgesVec;
3030
use crate::ty::TyCtxt;
3131
use crate::verify_ich::incremental_verify_ich;
@@ -252,7 +252,7 @@ impl DepGraph {
252252
}
253253

254254
#[inline(always)]
255-
pub fn with_task<Ctxt: HasDepContext<Deps = DepsType>, A: Debug, R>(
255+
pub fn with_task<Ctxt: HasDepContext, A: Debug, R>(
256256
&self,
257257
key: DepNode,
258258
cx: Ctxt,
@@ -266,7 +266,7 @@ impl DepGraph {
266266
}
267267
}
268268

269-
pub fn with_anon_task<Tcx: DepContext<Deps = DepsType>, OP, R>(
269+
pub fn with_anon_task<Tcx: DepContext, OP, R>(
270270
&self,
271271
cx: Tcx,
272272
dep_kind: DepKind,
@@ -315,7 +315,7 @@ impl DepGraphData {
315315
///
316316
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html
317317
#[inline(always)]
318-
pub fn with_task<Ctxt: HasDepContext<Deps = DepsType>, A: Debug, R>(
318+
pub fn with_task<Ctxt: HasDepContext, A: Debug, R>(
319319
&self,
320320
key: DepNode,
321321
cx: Ctxt,
@@ -369,7 +369,7 @@ impl DepGraphData {
369369
/// FIXME: This could perhaps return a `WithDepNode` to ensure that the
370370
/// user of this function actually performs the read; we'll have to see
371371
/// how to make that work with `anon` in `execute_job_incr`, though.
372-
pub fn with_anon_task_inner<Tcx: DepContext<Deps = DepsType>, OP, R>(
372+
pub fn with_anon_task_inner<Tcx: DepContext, OP, R>(
373373
&self,
374374
cx: Tcx,
375375
dep_kind: DepKind,
@@ -438,7 +438,7 @@ impl DepGraphData {
438438
}
439439

440440
/// Intern the new `DepNode` with the dependencies up-to-now.
441-
fn hash_result_and_alloc_node<Ctxt: DepContext<Deps = DepsType>, R>(
441+
fn hash_result_and_alloc_node<Ctxt: DepContext, R>(
442442
&self,
443443
cx: &Ctxt,
444444
node: DepNode,
@@ -553,7 +553,7 @@ impl DepGraph {
553553
/// FIXME: If the code is changed enough for this node to be marked before requiring the
554554
/// caller's node, we suppose that those changes will be enough to mark this node red and
555555
/// force a recomputation using the "normal" way.
556-
pub fn with_feed_task<Ctxt: DepContext<Deps = DepsType>, R>(
556+
pub fn with_feed_task<Ctxt: DepContext, R>(
557557
&self,
558558
node: DepNode,
559559
cx: Ctxt,

compiler/rustc_middle/src/dep_graph/mod.rs

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::panic;
22

33
use rustc_data_structures::profiling::SelfProfilerRef;
4-
use rustc_data_structures::sync::DynSync;
54
use rustc_query_system::ich::StableHashingContext;
65
use rustc_session::Session;
76
use tracing::instrument;
@@ -28,8 +27,6 @@ mod query;
2827
mod serialized;
2928

3029
pub trait DepContext: Copy {
31-
type Deps: Deps;
32-
3330
/// Create a hashing context for hashing new results.
3431
fn with_stable_hashing_context<R>(self, f: impl FnOnce(StableHashingContext<'_>) -> R) -> R;
3532

@@ -96,45 +93,13 @@ pub trait DepContext: Copy {
9693
fn with_reduced_queries<T>(self, _: impl FnOnce() -> T) -> T;
9794
}
9895

99-
pub trait Deps: DynSync {
100-
/// Execute the operation with provided dependencies.
101-
fn with_deps<OP, R>(deps: TaskDepsRef<'_>, op: OP) -> R
102-
where
103-
OP: FnOnce() -> R;
104-
105-
/// Access dependencies from current implicit context.
106-
fn read_deps<OP>(op: OP)
107-
where
108-
OP: for<'a> FnOnce(TaskDepsRef<'a>);
109-
110-
fn name(dep_kind: DepKind) -> &'static str;
111-
112-
/// We use this for most things when incr. comp. is turned off.
113-
const DEP_KIND_NULL: DepKind;
114-
115-
/// We use this to create a forever-red node.
116-
const DEP_KIND_RED: DepKind;
117-
118-
/// We use this to create a side effect node.
119-
const DEP_KIND_SIDE_EFFECT: DepKind;
120-
121-
/// We use this to create the anon node with zero dependencies.
122-
const DEP_KIND_ANON_ZERO_DEPS: DepKind;
123-
124-
/// This is the highest value a `DepKind` can have. It's used during encoding to
125-
/// pack information into the unused bits.
126-
const DEP_KIND_MAX: u16;
127-
}
128-
12996
pub trait HasDepContext: Copy {
130-
type Deps: self::Deps;
131-
type DepContext: self::DepContext<Deps = Self::Deps>;
97+
type DepContext: self::DepContext;
13298

13399
fn dep_context(&self) -> &Self::DepContext;
134100
}
135101

136102
impl<T: DepContext> HasDepContext for T {
137-
type Deps = T::Deps;
138103
type DepContext = Self;
139104

140105
fn dep_context(&self) -> &Self::DepContext {
@@ -143,7 +108,6 @@ impl<T: DepContext> HasDepContext for T {
143108
}
144109

145110
impl<T: HasDepContext, Q: Copy> HasDepContext for (T, Q) {
146-
type Deps = T::Deps;
147111
type DepContext = T::DepContext;
148112

149113
fn dep_context(&self) -> &Self::DepContext {
@@ -183,7 +147,8 @@ pub type DepKindVTable<'tcx> = dep_node::DepKindVTable<TyCtxt<'tcx>>;
183147

184148
pub struct DepsType;
185149

186-
impl Deps for DepsType {
150+
impl DepsType {
151+
/// Execute the operation with provided dependencies.
187152
fn with_deps<OP, R>(task_deps: TaskDepsRef<'_>, op: OP) -> R
188153
where
189154
OP: FnOnce() -> R,
@@ -195,6 +160,7 @@ impl Deps for DepsType {
195160
})
196161
}
197162

163+
/// Access dependencies from current implicit context.
198164
fn read_deps<OP>(op: OP)
199165
where
200166
OP: for<'a> FnOnce(TaskDepsRef<'a>),
@@ -209,16 +175,24 @@ impl Deps for DepsType {
209175
dep_node::DEP_KIND_NAMES[dep_kind.as_usize()]
210176
}
211177

178+
/// We use this for most things when incr. comp. is turned off.
212179
const DEP_KIND_NULL: DepKind = dep_kinds::Null;
180+
181+
/// We use this to create a forever-red node.
213182
const DEP_KIND_RED: DepKind = dep_kinds::Red;
183+
184+
/// We use this to create a side effect node.
214185
const DEP_KIND_SIDE_EFFECT: DepKind = dep_kinds::SideEffect;
186+
187+
/// We use this to create the anon node with zero dependencies.
215188
const DEP_KIND_ANON_ZERO_DEPS: DepKind = dep_kinds::AnonZeroDeps;
189+
190+
/// This is the highest value a `DepKind` can have. It's used during encoding to
191+
/// pack information into the unused bits.
216192
const DEP_KIND_MAX: u16 = dep_node::DEP_KIND_VARIANTS - 1;
217193
}
218194

219195
impl<'tcx> DepContext for TyCtxt<'tcx> {
220-
type Deps = DepsType;
221-
222196
#[inline]
223197
fn with_stable_hashing_context<R>(self, f: impl FnOnce(StableHashingContext<'_>) -> R) -> R {
224198
TyCtxt::with_stable_hashing_context(self, f)

compiler/rustc_middle/src/dep_graph/serialized.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use tracing::{debug, instrument};
6060

6161
use super::graph::{CurrentDepGraph, DepNodeColorMap};
6262
use super::query::DepGraphQuery;
63-
use super::{DepKind, DepNode, DepNodeIndex, Deps};
63+
use super::{DepKind, DepNode, DepNodeIndex};
6464
use crate::dep_graph::DepsType;
6565
use crate::dep_graph::edges::EdgesVec;
6666

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use rustc_middle::bug;
1515
#[expect(unused_imports, reason = "used by doc comments")]
1616
use rustc_middle::dep_graph::DepKindVTable;
1717
use rustc_middle::dep_graph::{
18-
self, DepContext, DepNode, DepNodeIndex, DepNodeKey, DepsType, HasDepContext,
19-
SerializedDepNodeIndex, dep_kinds,
18+
self, DepContext, DepNode, DepNodeIndex, DepNodeKey, HasDepContext, SerializedDepNodeIndex,
19+
dep_kinds,
2020
};
2121
use rustc_middle::query::on_disk_cache::{
2222
AbsoluteBytePos, CacheDecoder, CacheEncoder, EncodedDepNodeIndex,
@@ -142,7 +142,6 @@ impl<'tcx> QueryCtxt<'tcx> {
142142
}
143143

144144
impl<'tcx> HasDepContext for QueryCtxt<'tcx> {
145-
type Deps = DepsType;
146145
type DepContext = TyCtxt<'tcx>;
147146

148147
#[inline]

0 commit comments

Comments
 (0)