Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit dea342d

Browse files
committed
Make visiting traits generic over the Interner
1 parent 0b7dda9 commit dea342d

File tree

44 files changed

+121
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+121
-105
lines changed

compiler/rustc_const_eval/src/interpret/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ where
2121
tcx: TyCtxt<'tcx>,
2222
}
2323

24-
impl<'tcx> TypeVisitor<'tcx> for UsedParamsNeedSubstVisitor<'tcx> {
24+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for UsedParamsNeedSubstVisitor<'tcx> {
2525
type BreakTy = FoundParam;
2626

2727
fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes(
261261
selftys: Vec<(Span, Option<String>)>,
262262
}
263263

264-
impl<'tcx> ty::visit::ir::TypeVisitor<'tcx> for ProhibitOpaqueVisitor<'tcx> {
264+
impl<'tcx> ty::visit::ir::TypeVisitor<TyCtxt<'tcx>> for ProhibitOpaqueVisitor<'tcx> {
265265
type BreakTy = Ty<'tcx>;
266266

267267
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
@@ -1447,7 +1447,7 @@ fn opaque_type_cycle_error(
14471447
opaques: Vec<DefId>,
14481448
closures: Vec<DefId>,
14491449
}
1450-
impl<'tcx> ty::visit::ir::TypeVisitor<'tcx> for OpaqueTypeCollector {
1450+
impl<'tcx> ty::visit::ir::TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector {
14511451
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
14521452
match *t.kind() {
14531453
ty::Alias(ty::Opaque, ty::AliasTy { def_id: def, .. }) => {

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ impl<'tcx> GATSubstCollector<'tcx> {
772772
}
773773
}
774774

775-
impl<'tcx> TypeVisitor<'tcx> for GATSubstCollector<'tcx> {
775+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GATSubstCollector<'tcx> {
776776
type BreakTy = !;
777777

778778
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
@@ -1435,7 +1435,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
14351435
struct CountParams {
14361436
params: FxHashSet<u32>,
14371437
}
1438-
impl<'tcx> ty::visit::ir::TypeVisitor<'tcx> for CountParams {
1438+
impl<'tcx> ty::visit::ir::TypeVisitor<TyCtxt<'tcx>> for CountParams {
14391439
type BreakTy = ();
14401440

14411441
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ fn fast_reject_auto_impl<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, self_ty:
552552
seen: FxHashSet<DefId>,
553553
}
554554

555-
impl<'tcx> TypeVisitor<'tcx> for DisableAutoTraitVisitor<'tcx> {
555+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for DisableAutoTraitVisitor<'tcx> {
556556
type BreakTy = ();
557557
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
558558
let tcx = self.tcx;

compiler/rustc_hir_analysis/src/collect/lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,7 @@ fn is_late_bound_map(
17521752

17531753
use std::ops::ControlFlow;
17541754
use ty::Ty;
1755-
impl<'tcx> TypeVisitor<'tcx> for ConstrainedCollectorPostAstConv {
1755+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ConstrainedCollectorPostAstConv {
17561756
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<!> {
17571757
match t.kind() {
17581758
ty::Param(param_ty) => {

compiler/rustc_hir_analysis/src/constrained_generic_params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct ParameterCollector {
5656
include_nonconstraining: bool,
5757
}
5858

59-
impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
59+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ParameterCollector {
6060
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
6161
match *t.kind() {
6262
ty::Alias(ty::Projection, ..) if !self.include_nonconstraining => {

compiler/rustc_hir_analysis/src/variance/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
101101
}
102102
}
103103

104-
impl<'tcx> ty::ir::TypeVisitor<'tcx> for OpaqueTypeLifetimeCollector<'tcx> {
104+
impl<'tcx> ty::ir::TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeLifetimeCollector<'tcx> {
105105
#[instrument(level = "trace", skip(self), ret)]
106106
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
107107
if let ty::RegionKind::ReEarlyBound(ebr) = r.kind() {

compiler/rustc_hir_typeck/src/closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_infer::infer::{InferOk, InferResult};
1212
use rustc_macros::{TypeFoldable, TypeVisitable};
1313
use rustc_middle::ty::subst::InternalSubsts;
1414
use rustc_middle::ty::visit::TypeVisitable;
15-
use rustc_middle::ty::{self, ir::TypeVisitor, Ty, TypeSuperVisitable};
15+
use rustc_middle::ty::{self, ir::TypeVisitor, Ty, TyCtxt, TypeSuperVisitable};
1616
use rustc_span::def_id::LocalDefId;
1717
use rustc_span::source_map::Span;
1818
use rustc_span::sym;
@@ -232,7 +232,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
232232
struct MentionsTy<'tcx> {
233233
expected_ty: Ty<'tcx>,
234234
}
235-
impl<'tcx> TypeVisitor<'tcx> for MentionsTy<'tcx> {
235+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for MentionsTy<'tcx> {
236236
type BreakTy = ();
237237

238238
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {

compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ use rustc_hir as hir;
33
use rustc_hir::def::Res;
44
use rustc_hir::def_id::DefId;
55
use rustc_infer::traits::ObligationCauseCode;
6-
use rustc_middle::ty::{self, ir::TypeVisitor, DefIdTree, Ty, TypeSuperVisitable, TypeVisitable};
6+
use rustc_middle::ty::{
7+
self, ir::TypeVisitor, DefIdTree, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable,
8+
};
79
use rustc_span::{self, Span};
810
use rustc_trait_selection::traits;
911

@@ -247,7 +249,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
247249
t: T,
248250
) -> Option<ty::GenericArg<'tcx>> {
249251
struct FindAmbiguousParameter<'a, 'tcx>(&'a FnCtxt<'a, 'tcx>, DefId);
250-
impl<'tcx> TypeVisitor<'tcx> for FindAmbiguousParameter<'_, 'tcx> {
252+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for FindAmbiguousParameter<'_, 'tcx> {
251253
type BreakTy = ty::GenericArg<'tcx>;
252254
fn visit_ty(&mut self, ty: Ty<'tcx>) -> std::ops::ControlFlow<Self::BreakTy> {
253255
if let Some(origin) = self.0.type_var_origin(ty)

compiler/rustc_hir_typeck/src/writeback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
561561
struct RecursionChecker {
562562
def_id: LocalDefId,
563563
}
564-
impl<'tcx> ty::ir::TypeVisitor<'tcx> for RecursionChecker {
564+
impl<'tcx> ty::ir::TypeVisitor<TyCtxt<'tcx>> for RecursionChecker {
565565
type BreakTy = ();
566566
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
567567
if let ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) = *t.kind() {

0 commit comments

Comments
 (0)