Skip to content

Commit 8fcd967

Browse files
committed
Make visiting generic over the interner
1 parent f92b450 commit 8fcd967

File tree

51 files changed

+273
-193
lines changed

Some content is hidden

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

51 files changed

+273
-193
lines changed

compiler/rustc_borrowck/src/constraint_generation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::mir::{
99
};
1010
use rustc_middle::ty::subst::SubstsRef;
1111
use rustc_middle::ty::visit::TypeVisitable;
12-
use rustc_middle::ty::{self, RegionVid, Ty};
12+
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
1313

1414
use crate::{
1515
borrow_set::BorrowSet, facts::AllFacts, location::LocationTable, nll::ToRegionVid,
@@ -165,7 +165,7 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
165165
/// `location`.
166166
fn add_regular_live_constraint<T>(&mut self, live_ty: T, location: Location)
167167
where
168-
T: TypeVisitable<'tcx>,
168+
T: TypeVisitable<TyCtxt<'tcx>>,
169169
{
170170
debug!("add_regular_live_constraint(live_ty={:?}, location={:?})", live_ty, location);
171171

compiler/rustc_borrowck/src/type_check/liveness/trace.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_index::bit_set::HybridBitSet;
33
use rustc_index::interval::IntervalSet;
44
use rustc_infer::infer::canonical::QueryRegionConstraints;
55
use rustc_middle::mir::{BasicBlock, Body, ConstraintCategory, Local, Location};
6-
use rustc_middle::ty::{Ty, TypeVisitable};
6+
use rustc_middle::ty::{Ty, TyCtxt, TypeVisitable};
77
use rustc_trait_selection::traits::query::dropck_outlives::DropckOutlivesResult;
88
use rustc_trait_selection::traits::query::type_op::outlives::DropckOutlives;
99
use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
@@ -477,7 +477,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
477477
/// points `live_at`.
478478
fn add_use_live_facts_for(
479479
&mut self,
480-
value: impl TypeVisitable<'tcx>,
480+
value: impl TypeVisitable<TyCtxt<'tcx>>,
481481
live_at: &IntervalSet<PointIndex>,
482482
) {
483483
debug!("add_use_live_facts_for(value={:?})", value);
@@ -542,7 +542,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
542542
fn make_all_regions_live(
543543
elements: &RegionValueElements,
544544
typeck: &mut TypeChecker<'_, 'tcx>,
545-
value: impl TypeVisitable<'tcx>,
545+
value: impl TypeVisitable<TyCtxt<'tcx>>,
546546
live_at: &IntervalSet<PointIndex>,
547547
) {
548548
debug!("make_all_regions_live(value={:?})", value);

compiler/rustc_const_eval/src/interpret/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::ops::ControlFlow;
99
/// case these parameters are unused.
1010
pub(crate) fn ensure_monomorphic_enough<'tcx, T>(tcx: TyCtxt<'tcx>, ty: T) -> InterpResult<'tcx>
1111
where
12-
T: TypeVisitable<'tcx>,
12+
T: TypeVisitable<TyCtxt<'tcx>>,
1313
{
1414
debug!("ensure_monomorphic_enough: ty={:?}", ty);
1515
if !ty.needs_subst() {
@@ -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::TypeVisitor<'tcx> for ProhibitOpaqueVisitor<'tcx> {
264+
impl<'tcx> ty::visit::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::TypeVisitor<'tcx> for OpaqueTypeCollector {
1450+
impl<'tcx> ty::visit::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
@@ -773,7 +773,7 @@ impl<'tcx> GATSubstCollector<'tcx> {
773773
}
774774
}
775775

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

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

14421442
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn parameters_for_impl<'tcx>(
4343
/// of parameters whose values are needed in order to constrain `ty` - these
4444
/// differ, with the latter being a superset, in the presence of projections.
4545
pub fn parameters_for<'tcx>(
46-
t: &impl TypeVisitable<'tcx>,
46+
t: &impl TypeVisitable<TyCtxt<'tcx>>,
4747
include_nonconstraining: bool,
4848
) -> Vec<Parameter> {
4949
let mut collector = ParameterCollector { parameters: vec![], include_nonconstraining };
@@ -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
@@ -99,7 +99,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
9999
}
100100
}
101101

102-
impl<'tcx> ty::TypeVisitor<'tcx> for OpaqueTypeLifetimeCollector<'tcx> {
102+
impl<'tcx> ty::TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeLifetimeCollector<'tcx> {
103103
#[instrument(level = "trace", skip(self), ret)]
104104
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
105105
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, Ty, TypeSuperVisitable, TypeVisitor};
15+
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
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/_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_middle::ty::error::TypeError;
2525
use rustc_middle::ty::fold::TypeFoldable;
2626
use rustc_middle::ty::visit::TypeVisitable;
2727
use rustc_middle::ty::{
28-
self, AdtKind, CanonicalUserType, DefIdTree, GenericParamDefKind, Ty, UserType,
28+
self, AdtKind, CanonicalUserType, DefIdTree, GenericParamDefKind, Ty, TyCtxt, UserType,
2929
};
3030
use rustc_middle::ty::{GenericArgKind, SubstsRef, UserSelfTy, UserSubsts};
3131
use rustc_session::lint;
@@ -443,7 +443,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
443443
// sufficiently enforced with erased regions. =)
444444
fn can_contain_user_lifetime_bounds<T>(t: T) -> bool
445445
where
446-
T: TypeVisitable<'tcx>,
446+
T: TypeVisitable<TyCtxt<'tcx>>,
447447
{
448448
t.has_free_regions() || t.has_projections() || t.has_infer_types()
449449
}

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ use rustc_infer::infer::InferOk;
2626
use rustc_infer::infer::TypeTrace;
2727
use rustc_middle::ty::adjustment::AllowTwoPhase;
2828
use rustc_middle::ty::visit::TypeVisitable;
29-
use rustc_middle::ty::{self, DefIdTree, IsSuggestable, Ty, TypeSuperVisitable, TypeVisitor};
29+
use rustc_middle::ty::{
30+
self, DefIdTree, IsSuggestable, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor,
31+
};
3032
use rustc_session::Session;
3133
use rustc_span::symbol::{kw, Ident};
3234
use rustc_span::{self, sym, Span};
@@ -2078,13 +2080,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20782080
true
20792081
}
20802082

2081-
fn find_ambiguous_parameter_in<T: TypeVisitable<'tcx>>(
2083+
fn find_ambiguous_parameter_in<T: TypeVisitable<TyCtxt<'tcx>>>(
20822084
&self,
20832085
item_def_id: DefId,
20842086
t: T,
20852087
) -> Option<ty::GenericArg<'tcx>> {
20862088
struct FindAmbiguousParameter<'a, 'tcx>(&'a FnCtxt<'a, 'tcx>, DefId);
2087-
impl<'tcx> TypeVisitor<'tcx> for FindAmbiguousParameter<'_, 'tcx> {
2089+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for FindAmbiguousParameter<'_, 'tcx> {
20882090
type BreakTy = ty::GenericArg<'tcx>;
20892091
fn visit_ty(&mut self, ty: Ty<'tcx>) -> std::ops::ControlFlow<Self::BreakTy> {
20902092
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::TypeVisitor<'tcx> for RecursionChecker {
564+
impl<'tcx> ty::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() {

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,8 +1435,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
14351435
impl<'tcx> OpaqueTypesVisitor<'tcx> {
14361436
fn visit_expected_found(
14371437
tcx: TyCtxt<'tcx>,
1438-
expected: impl TypeVisitable<'tcx>,
1439-
found: impl TypeVisitable<'tcx>,
1438+
expected: impl TypeVisitable<TyCtxt<'tcx>>,
1439+
found: impl TypeVisitable<TyCtxt<'tcx>>,
14401440
ignore_span: Span,
14411441
) -> Self {
14421442
let mut types_visitor = OpaqueTypesVisitor {
@@ -1486,7 +1486,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
14861486
}
14871487
}
14881488

1489-
impl<'tcx> ty::visit::TypeVisitor<'tcx> for OpaqueTypesVisitor<'tcx> {
1489+
impl<'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for OpaqueTypesVisitor<'tcx> {
14901490
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
14911491
if let Some((kind, def_id)) = TyCategory::from_ty(self.tcx, t) {
14921492
let span = self.tcx.def_span(def_id);

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
539539
/// Collect all the trait objects in a type that could have received an implicit `'static` lifetime.
540540
pub struct TraitObjectVisitor(pub FxIndexSet<DefId>);
541541

542-
impl<'tcx> TypeVisitor<'tcx> for TraitObjectVisitor {
542+
impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for TraitObjectVisitor {
543543
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
544544
match t.kind() {
545545
ty::Dynamic(preds, re, _) if re.is_static() => {

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
7575
}
7676
}
7777

78-
impl<'tcx> ty::visit::TypeVisitor<'tcx> for HighlightBuilder<'tcx> {
78+
impl<'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for HighlightBuilder<'tcx> {
7979
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
8080
if !r.has_name() && self.counter <= 3 {
8181
self.highlight.highlighting_region(r, self.counter);

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
145145

146146
fn includes_region(
147147
&self,
148-
ty: Binder<'tcx, impl TypeVisitable<'tcx>>,
148+
ty: Binder<'tcx, impl TypeVisitable<TyCtxt<'tcx>>>,
149149
region: ty::BoundRegionKind,
150150
) -> bool {
151151
let late_bound_regions = self.tcx().collect_referenced_late_bound_regions(&ty);

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ impl<'tcx> InferCtxt<'tcx> {
14131413
value: &T,
14141414
) -> Option<(ty::Term<'tcx>, Option<Span>)>
14151415
where
1416-
T: TypeVisitable<'tcx>,
1416+
T: TypeVisitable<TyCtxt<'tcx>>,
14171417
{
14181418
value.visit_with(&mut resolve::UnresolvedTypeOrConstFinder::new(self)).break_value()
14191419
}

compiler/rustc_infer/src/infer/nll_relate/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,8 @@ struct ScopeInstantiator<'me, 'tcx> {
841841
bound_region_scope: &'me mut BoundRegionScope<'tcx>,
842842
}
843843

844-
impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
845-
fn visit_binder<T: TypeVisitable<'tcx>>(
844+
impl<'me, 'tcx> TypeVisitor<TyCtxt<'tcx>> for ScopeInstantiator<'me, 'tcx> {
845+
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(
846846
&mut self,
847847
t: &ty::Binder<'tcx, T>,
848848
) -> ControlFlow<Self::BreakTy> {

compiler/rustc_infer/src/infer/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,11 @@ pub struct ConstrainOpaqueTypeRegionVisitor<'tcx, OP: FnMut(ty::Region<'tcx>)> {
431431
pub op: OP,
432432
}
433433

434-
impl<'tcx, OP> TypeVisitor<'tcx> for ConstrainOpaqueTypeRegionVisitor<'tcx, OP>
434+
impl<'tcx, OP> TypeVisitor<TyCtxt<'tcx>> for ConstrainOpaqueTypeRegionVisitor<'tcx, OP>
435435
where
436436
OP: FnMut(ty::Region<'tcx>),
437437
{
438-
fn visit_binder<T: TypeVisitable<'tcx>>(
438+
fn visit_binder<T: TypeVisitable<TyCtxt<'tcx>>>(
439439
&mut self,
440440
t: &ty::Binder<'tcx, T>,
441441
) -> ControlFlow<Self::BreakTy> {

compiler/rustc_infer/src/infer/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a, 'tcx> UnresolvedTypeOrConstFinder<'a, 'tcx> {
121121
}
122122
}
123123

124-
impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeOrConstFinder<'a, 'tcx> {
124+
impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for UnresolvedTypeOrConstFinder<'a, 'tcx> {
125125
type BreakTy = (ty::Term<'tcx>, Option<Span>);
126126
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
127127
let t = self.infcx.shallow_resolve(t);

compiler/rustc_infer/src/traits/structural_impls.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::traits;
22
use crate::traits::project::Normalized;
3-
use rustc_middle::ty;
43
use rustc_middle::ty::fold::{FallibleTypeFolder, TypeFoldable};
54
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitor};
5+
use rustc_middle::ty::{self, TyCtxt};
66

77
use std::fmt;
88
use std::ops::ControlFlow;
@@ -72,8 +72,10 @@ impl<'tcx, O: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Obligation<'tcx
7272
}
7373
}
7474

75-
impl<'tcx, O: TypeVisitable<'tcx>> TypeVisitable<'tcx> for traits::Obligation<'tcx, O> {
76-
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
75+
impl<'tcx, O: TypeVisitable<TyCtxt<'tcx>>> TypeVisitable<TyCtxt<'tcx>>
76+
for traits::Obligation<'tcx, O>
77+
{
78+
fn visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
7779
self.predicate.visit_with(visitor)?;
7880
self.param_env.visit_with(visitor)
7981
}

compiler/rustc_lint/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
11441144

11451145
fn check_for_opaque_ty(&mut self, sp: Span, ty: Ty<'tcx>) -> bool {
11461146
struct ProhibitOpaqueTypes;
1147-
impl<'tcx> ty::visit::TypeVisitor<'tcx> for ProhibitOpaqueTypes {
1147+
impl<'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for ProhibitOpaqueTypes {
11481148
type BreakTy = Ty<'tcx>;
11491149

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

compiler/rustc_macros/src/type_visitable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ pub fn type_visitable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2:
1919
s.bind_with(|_| synstructure::BindStyle::Move);
2020

2121
s.bound_impl(
22-
quote!(::rustc_middle::ty::visit::TypeVisitable<'tcx>),
22+
quote!(::rustc_middle::ty::visit::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>),
2323
quote! {
24-
fn visit_with<__V: ::rustc_middle::ty::visit::TypeVisitor<'tcx>>(
24+
fn visit_with<__V: ::rustc_middle::ty::visit::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(
2525
&self,
2626
__visitor: &mut __V
2727
) -> ::std::ops::ControlFlow<__V::BreakTy> {

compiler/rustc_middle/src/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ macro_rules! TrivialTypeTraversalImpls {
8686
}
8787
}
8888

89-
impl<$tcx> $crate::ty::visit::TypeVisitable<$tcx> for $ty {
89+
impl<$tcx> $crate::ty::visit::TypeVisitable<$crate::ty::TyCtxt<$tcx>> for $ty {
9090
#[inline]
91-
fn visit_with<F: $crate::ty::visit::TypeVisitor<$tcx>>(
91+
fn visit_with<F: $crate::ty::visit::TypeVisitor<$crate::ty::TyCtxt<$tcx>>>(
9292
&self,
9393
_: &mut F)
9494
-> ::std::ops::ControlFlow<F::BreakTy>
@@ -133,7 +133,7 @@ macro_rules! EnumTypeTraversalImpl {
133133
}
134134
};
135135

136-
(impl<$($p:tt),*> TypeVisitable<$tcx:tt> for $s:path {
136+
(impl<$($p:tt),*> TypeVisitable<$tcx:ty> for $s:path {
137137
$($variants:tt)*
138138
} $(where $($wc:tt)*)*) => {
139139
impl<$($p),*> $crate::ty::visit::TypeVisitable<$tcx> for $s

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,8 +2751,11 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection {
27512751
}
27522752
}
27532753

2754-
impl<'tcx> TypeVisitable<'tcx> for UserTypeProjection {
2755-
fn visit_with<Vs: TypeVisitor<'tcx>>(&self, visitor: &mut Vs) -> ControlFlow<Vs::BreakTy> {
2754+
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for UserTypeProjection {
2755+
fn visit_with<Vs: TypeVisitor<TyCtxt<'tcx>>>(
2756+
&self,
2757+
visitor: &mut Vs,
2758+
) -> ControlFlow<Vs::BreakTy> {
27562759
self.base.visit_with(visitor)
27572760
// Note: there's nothing in `self.proj` to visit.
27582761
}

compiler/rustc_middle/src/mir/type_visitable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
use super::*;
44

5-
impl<'tcx, R: Idx, C: Idx> TypeVisitable<'tcx> for BitMatrix<R, C> {
6-
fn visit_with<V: TypeVisitor<'tcx>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
5+
impl<'tcx, R: Idx, C: Idx> TypeVisitable<TyCtxt<'tcx>> for BitMatrix<R, C> {
6+
fn visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut V) -> ControlFlow<V::BreakTy> {
77
ControlFlow::Continue(())
88
}
99
}

0 commit comments

Comments
 (0)