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> {

0 commit comments

Comments
 (0)