Remove unnecessary trait HasDepContext

This commit is contained in:
Zalathar 2026-02-15 19:35:32 +11:00
parent db58395a6b
commit 25d5cd2eb0
2 changed files with 3 additions and 16 deletions

View file

@ -23,7 +23,7 @@ use {super::debug::EdgeFilter, std::env};
use super::query::DepGraphQuery;
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};
use super::{DepKind, DepNode, HasDepContext, WorkProductId, read_deps, with_deps};
use super::{DepKind, DepNode, WorkProductId, read_deps, with_deps};
use crate::dep_graph::edges::EdgesVec;
use crate::ich::StableHashingContext;
use crate::ty::TyCtxt;
@ -938,7 +938,7 @@ impl DepGraphData {
// We failed to mark it green, so we try to force the query.
debug!("trying to force dependency {dep_dep_node:?}");
if !tcx.dep_context().try_force_from_dep_node(*dep_dep_node, parent_dep_node_index, frame) {
if !tcx.try_force_from_dep_node(*dep_dep_node, parent_dep_node_index, frame) {
// The DepNode could not be forced.
debug!("dependency {dep_dep_node:?} could not be forced");
return None;
@ -985,10 +985,7 @@ impl DepGraphData {
let frame = MarkFrame { index: prev_dep_node_index, parent: frame };
// We never try to mark eval_always nodes as green
debug_assert!(
!tcx.dep_context()
.is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind)
);
debug_assert!(!tcx.is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind));
let prev_deps = self.previous.edge_targets_from(prev_dep_node_index);

View file

@ -25,16 +25,6 @@ mod graph;
mod query;
mod serialized;
pub trait HasDepContext<'tcx>: Copy {
fn dep_context(&self) -> TyCtxt<'tcx>;
}
impl<'tcx> HasDepContext<'tcx> for TyCtxt<'tcx> {
fn dep_context(&self) -> TyCtxt<'tcx> {
*self
}
}
/// Describes the contents of the fingerprint generated by a given query.
///
/// This is mainly for determining whether and how we can reconstruct a key