Skip to content

Commit 695072d

Browse files
committed
Remove type-traversal trait aliases
1 parent 3b4d6e0 commit 695072d

File tree

191 files changed

+657
-569
lines changed

Some content is hidden

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

191 files changed

+657
-569
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/diagnostics/bound_region_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'tcx> ToUniverseInfo<'tcx>
106106
}
107107
}
108108

109-
impl<'tcx, T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx> ToUniverseInfo<'tcx>
109+
impl<'tcx, T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx> ToUniverseInfo<'tcx>
110110
for Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize<T>>>
111111
{
112112
fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
@@ -258,7 +258,7 @@ struct NormalizeQuery<'tcx, T> {
258258

259259
impl<'tcx, T> TypeOpInfo<'tcx> for NormalizeQuery<'tcx, T>
260260
where
261-
T: Copy + fmt::Display + TypeFoldable<'tcx> + 'tcx,
261+
T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx,
262262
{
263263
fn fallback_error(
264264
&self,

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::mir::{
1717
};
1818
use rustc_middle::traits::ObligationCause;
1919
use rustc_middle::traits::ObligationCauseCode;
20-
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable};
20+
use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
2121
use rustc_span::Span;
2222

2323
use crate::{
@@ -1366,7 +1366,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13661366
/// we use this kind of hacky solution.
13671367
fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
13681368
where
1369-
T: TypeFoldable<'tcx>,
1369+
T: TypeFoldable<TyCtxt<'tcx>>,
13701370
{
13711371
tcx.fold_regions(value, |r, _db| {
13721372
let vid = self.to_region_vid(r);

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_infer::infer::TyCtxtInferExt as _;
66
use rustc_infer::infer::{DefiningAnchor, InferCtxt};
77
use rustc_infer::traits::{Obligation, ObligationCause};
88
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
9-
use rustc_middle::ty::visit::TypeVisitable;
9+
use rustc_middle::ty::visit::TypeVisitableExt;
1010
use rustc_middle::ty::{self, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable};
1111
use rustc_span::Span;
1212
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
@@ -178,7 +178,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
178178
/// region names in error messages.
179179
pub(crate) fn name_regions<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T
180180
where
181-
T: TypeFoldable<'tcx>,
181+
T: TypeFoldable<TyCtxt<'tcx>>,
182182
{
183183
tcx.fold_regions(ty, |region, _| match *region {
184184
ty::ReVar(vid) => {

compiler/rustc_borrowck/src/renumber.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) fn renumber_regions<'tcx, T, F>(
3838
get_ctxt_fn: F,
3939
) -> T
4040
where
41-
T: TypeFoldable<'tcx>,
41+
T: TypeFoldable<TyCtxt<'tcx>>,
4242
F: Fn() -> RegionCtxt,
4343
{
4444
infcx.tcx.fold_regions(value, |_region, _depth| {
@@ -89,7 +89,7 @@ struct NllVisitor<'a, 'tcx> {
8989
impl<'a, 'tcx> NllVisitor<'a, 'tcx> {
9090
fn renumber_regions<T, F>(&mut self, value: T, region_ctxt_fn: F) -> T
9191
where
92-
T: TypeFoldable<'tcx>,
92+
T: TypeFoldable<TyCtxt<'tcx>>,
9393
F: Fn() -> RegionCtxt,
9494
{
9595
renumber_regions(self.infcx, value, region_ctxt_fn)

compiler/rustc_borrowck/src/type_check/canonical.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt;
22

33
use rustc_infer::infer::{canonical::Canonical, InferOk};
44
use rustc_middle::mir::ConstraintCategory;
5-
use rustc_middle::ty::{self, ToPredicate, Ty, TypeFoldable};
5+
use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable};
66
use rustc_span::def_id::DefId;
77
use rustc_span::Span;
88
use rustc_trait_selection::traits::query::type_op::{self, TypeOpOutput};
@@ -66,7 +66,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
6666
canonical: &Canonical<'tcx, T>,
6767
) -> T
6868
where
69-
T: TypeFoldable<'tcx>,
69+
T: TypeFoldable<TyCtxt<'tcx>>,
7070
{
7171
let old_universe = self.infcx.universe();
7272

compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
66
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
77
use rustc_middle::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, ConstraintCategory};
88
use rustc_middle::ty::subst::GenericArgKind;
9-
use rustc_middle::ty::TypeFoldable;
109
use rustc_middle::ty::{self, TyCtxt};
10+
use rustc_middle::ty::{TypeFoldable, TypeVisitableExt};
1111
use rustc_span::{Span, DUMMY_SP};
1212

1313
use crate::{
@@ -171,7 +171,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
171171
///
172172
/// FIXME: This should get removed once higher ranked region obligations
173173
/// are dealt with during trait solving.
174-
fn replace_placeholders_with_nll<T: TypeFoldable<'tcx>>(&mut self, value: T) -> T {
174+
fn replace_placeholders_with_nll<T: TypeFoldable<TyCtxt<'tcx>>>(&mut self, value: T) -> T {
175175
if value.has_placeholders() {
176176
self.tcx.fold_regions(value, |r, _| match *r {
177177
ty::RePlaceholder(placeholder) => {

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, TypeVisitableExt};
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_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use rustc_middle::mir::*;
3030
use rustc_middle::ty::adjustment::PointerCast;
3131
use rustc_middle::ty::cast::CastTy;
3232
use rustc_middle::ty::subst::{SubstsRef, UserSubsts};
33-
use rustc_middle::ty::visit::TypeVisitable;
33+
use rustc_middle::ty::visit::TypeVisitableExt;
3434
use rustc_middle::ty::{
3535
self, Binder, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, Dynamic,
3636
OpaqueHiddenType, OpaqueTypeKey, RegionVid, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ trait InferCtxtExt<'tcx> {
728728
value: T,
729729
) -> T
730730
where
731-
T: TypeFoldable<'tcx>;
731+
T: TypeFoldable<TyCtxt<'tcx>>;
732732

733733
fn replace_bound_regions_with_nll_infer_vars<T>(
734734
&self,
@@ -738,7 +738,7 @@ trait InferCtxtExt<'tcx> {
738738
indices: &mut UniversalRegionIndices<'tcx>,
739739
) -> T
740740
where
741-
T: TypeFoldable<'tcx>;
741+
T: TypeFoldable<TyCtxt<'tcx>>;
742742

743743
fn replace_late_bound_regions_with_nll_infer_vars_in_recursive_scope(
744744
&self,
@@ -761,7 +761,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
761761
value: T,
762762
) -> T
763763
where
764-
T: TypeFoldable<'tcx>,
764+
T: TypeFoldable<TyCtxt<'tcx>>,
765765
{
766766
self.infcx.tcx.fold_regions(value, |region, _depth| {
767767
let name = match region.get_name() {
@@ -785,7 +785,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
785785
indices: &mut UniversalRegionIndices<'tcx>,
786786
) -> T
787787
where
788-
T: TypeFoldable<'tcx>,
788+
T: TypeFoldable<TyCtxt<'tcx>>,
789789
{
790790
let (value, _map) = self.tcx.replace_late_bound_regions(value, |br| {
791791
debug!(?br);
@@ -906,7 +906,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
906906
/// returned by `to_region_vid`.
907907
pub fn fold_to_region_vids<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
908908
where
909-
T: TypeFoldable<'tcx>,
909+
T: TypeFoldable<TyCtxt<'tcx>>,
910910
{
911911
tcx.fold_regions(value, |region, _| tcx.mk_re_var(self.to_region_vid(region)))
912912
}

0 commit comments

Comments
 (0)