Skip to content

Commit e9e5d06

Browse files
committed
Relax constrained generics to TypeVisitable
1 parent f66c06f commit e9e5d06

File tree

23 files changed

+56
-43
lines changed

23 files changed

+56
-43
lines changed

Diff for: compiler/rustc_borrowck/src/constraint_generation.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_middle::mir::{
77
};
88
use rustc_middle::ty::fold::TypeFoldable;
99
use rustc_middle::ty::subst::SubstsRef;
10+
use rustc_middle::ty::visit::TypeVisitable;
1011
use rustc_middle::ty::{self, RegionVid, Ty};
1112

1213
use crate::{
@@ -163,7 +164,7 @@ impl<'cx, 'cg, 'tcx> ConstraintGeneration<'cx, 'cg, 'tcx> {
163164
/// `location`.
164165
fn add_regular_live_constraint<T>(&mut self, live_ty: T, location: Location)
165166
where
166-
T: TypeFoldable<'tcx>,
167+
T: TypeVisitable<'tcx>,
167168
{
168169
debug!("add_regular_live_constraint(live_ty={:?}, location={:?})", live_ty, location);
169170

Diff for: compiler/rustc_borrowck/src/type_check/liveness/trace.rs

+3-3
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, TypeFoldable};
6+
use rustc_middle::ty::{Ty, TypeFoldable, 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 TypeFoldable<'tcx>,
480+
value: impl TypeVisitable<'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 TypeFoldable<'tcx>,
545+
value: impl TypeVisitable<'tcx>,
546546
live_at: &IntervalSet<PointIndex>,
547547
) {
548548
debug!("make_all_regions_live(value={:?})", value);

Diff for: compiler/rustc_const_eval/src/interpret/util.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc_middle::mir::interpret::InterpResult;
2-
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitor};
2+
use rustc_middle::ty::{
3+
self, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitor,
4+
};
35
use std::convert::TryInto;
46
use std::ops::ControlFlow;
57

@@ -10,7 +12,7 @@ use std::ops::ControlFlow;
1012
/// case these parameters are unused.
1113
pub(crate) fn ensure_monomorphic_enough<'tcx, T>(tcx: TyCtxt<'tcx>, ty: T) -> InterpResult<'tcx>
1214
where
13-
T: TypeFoldable<'tcx>,
15+
T: TypeVisitable<'tcx>,
1416
{
1517
debug!("ensure_monomorphic_enough: ty={:?}", ty);
1618
if !ty.needs_subst() {

Diff for: compiler/rustc_infer/src/infer/error_reporting/nice_region_error/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::infer::error_reporting::nice_region_error::NiceRegionError;
55
use crate::infer::TyCtxt;
66
use rustc_hir as hir;
77
use rustc_hir::def_id::LocalDefId;
8-
use rustc_middle::ty::{self, Binder, DefIdTree, Region, Ty, TypeFoldable};
8+
use rustc_middle::ty::{self, Binder, DefIdTree, Region, Ty, TypeFoldable, TypeVisitable};
99
use rustc_span::Span;
1010

1111
/// Information about the anonymous region we are searching for.
@@ -142,7 +142,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
142142

143143
fn includes_region(
144144
&self,
145-
ty: Binder<'tcx, impl TypeFoldable<'tcx>>,
145+
ty: Binder<'tcx, impl TypeVisitable<'tcx>>,
146146
region: ty::BoundRegionKind,
147147
) -> bool {
148148
let late_bound_regions = self.tcx().collect_referenced_late_bound_regions(&ty);

Diff for: compiler/rustc_infer/src/infer/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use rustc_middle::ty::error::{ExpectedFound, TypeError};
2525
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
2626
use rustc_middle::ty::relate::RelateResult;
2727
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, InternalSubsts, SubstsRef};
28+
use rustc_middle::ty::visit::TypeVisitable;
2829
pub use rustc_middle::ty::IntVarValue;
2930
use rustc_middle::ty::{self, GenericParamDefKind, InferConst, Ty, TyCtxt};
3031
use rustc_middle::ty::{ConstVid, FloatVid, IntVid, TyVid};
@@ -1438,7 +1439,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14381439
/// `resolve_vars_if_possible()`.
14391440
pub fn unresolved_type_vars<T>(&self, value: &T) -> Option<(Ty<'tcx>, Option<Span>)>
14401441
where
1441-
T: TypeFoldable<'tcx>,
1442+
T: TypeVisitable<'tcx>,
14421443
{
14431444
value.visit_with(&mut resolve::UnresolvedTypeFinder::new(self)).break_value()
14441445
}

Diff for: compiler/rustc_infer/src/infer/nll_relate/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use rustc_data_structures::fx::FxHashMap;
2929
use rustc_middle::ty::error::TypeError;
3030
use rustc_middle::ty::fold::{TypeFoldable, TypeSuperFoldable, TypeVisitor};
3131
use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation};
32+
use rustc_middle::ty::visit::TypeVisitable;
3233
use rustc_middle::ty::{self, InferConst, Ty, TyCtxt};
3334
use rustc_span::Span;
3435
use std::fmt::Debug;
@@ -810,7 +811,7 @@ struct ScopeInstantiator<'me, 'tcx> {
810811
}
811812

812813
impl<'me, 'tcx> TypeVisitor<'tcx> for ScopeInstantiator<'me, 'tcx> {
813-
fn visit_binder<T: TypeFoldable<'tcx>>(
814+
fn visit_binder<T: TypeVisitable<'tcx>>(
814815
&mut self,
815816
t: &ty::Binder<'tcx, T>,
816817
) -> ControlFlow<Self::BreakTy> {

Diff for: compiler/rustc_infer/src/infer/opaque_types.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use rustc_middle::traits::ObligationCause;
99
use rustc_middle::ty::fold::BottomUpFolder;
1010
use rustc_middle::ty::subst::{GenericArgKind, Subst};
1111
use rustc_middle::ty::{
12-
self, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitor,
12+
self, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable,
13+
TypeVisitable, TypeVisitor,
1314
};
1415
use rustc_span::Span;
1516

@@ -461,7 +462,7 @@ impl<'tcx, OP> TypeVisitor<'tcx> for ConstrainOpaqueTypeRegionVisitor<OP>
461462
where
462463
OP: FnMut(ty::Region<'tcx>),
463464
{
464-
fn visit_binder<T: TypeFoldable<'tcx>>(
465+
fn visit_binder<T: TypeVisitable<'tcx>>(
465466
&mut self,
466467
t: &ty::Binder<'tcx, T>,
467468
) -> ControlFlow<Self::BreakTy> {

Diff for: compiler/rustc_middle/src/ty/diagnostics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use std::ops::ControlFlow;
44

55
use crate::ty::{
6-
fold::TypeFoldable, Const, ConstKind, DefIdTree, ExistentialPredicate, InferTy,
7-
PolyTraitPredicate, Ty, TyCtxt, TypeSuperFoldable, TypeVisitor,
6+
fold::TypeFoldable, visit::TypeVisitable, Const, ConstKind, DefIdTree, ExistentialPredicate,
7+
InferTy, PolyTraitPredicate, Ty, TyCtxt, TypeSuperFoldable, TypeVisitor,
88
};
99

1010
use rustc_data_structures::fx::FxHashMap;
@@ -87,7 +87,7 @@ pub trait IsSuggestable<'tcx> {
8787

8888
impl<'tcx, T> IsSuggestable<'tcx> for T
8989
where
90-
T: TypeFoldable<'tcx>,
90+
T: TypeVisitable<'tcx>,
9191
{
9292
fn is_suggestable(self, tcx: TyCtxt<'tcx>) -> bool {
9393
self.visit_with(&mut IsSuggestableVisitor { tcx }).is_continue()

Diff for: compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ impl<'tcx> ParamEnv<'tcx> {
15141514
/// `where Box<u32>: Copy`, which are clearly never
15151515
/// satisfiable. We generally want to behave as if they were true,
15161516
/// although the surrounding function is never reachable.
1517-
pub fn and<T: TypeFoldable<'tcx>>(self, value: T) -> ParamEnvAnd<'tcx, T> {
1517+
pub fn and<T: TypeVisitable<'tcx>>(self, value: T) -> ParamEnvAnd<'tcx, T> {
15181518
match self.reveal() {
15191519
Reveal::UserFacing => ParamEnvAnd { param_env: self, value },
15201520

Diff for: compiler/rustc_middle/src/ty/print/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::mir::interpret::{AllocRange, GlobalAlloc, Pointer, Provenance, Scalar
22
use crate::ty::subst::{GenericArg, GenericArgKind, Subst};
33
use crate::ty::{
44
self, ConstInt, DefIdTree, ParamConst, ScalarInt, Term, Ty, TyCtxt, TypeFoldable,
5-
TypeSuperFoldable,
5+
TypeSuperFoldable, TypeVisitable,
66
};
77
use rustc_apfloat::ieee::{Double, Single};
88
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
@@ -2277,7 +2277,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
22772277

22782278
fn prepare_late_bound_region_info<T>(&mut self, value: &ty::Binder<'tcx, T>)
22792279
where
2280-
T: TypeFoldable<'tcx>,
2280+
T: TypeVisitable<'tcx>,
22812281
{
22822282
struct LateBoundRegionNameCollector<'a, 'tcx> {
22832283
used_region_names: &'a mut FxHashSet<Symbol>,

Diff for: compiler/rustc_middle/src/ty/structural_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::PredicateKind<'a> {
453453

454454
impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder<'a, T>
455455
where
456-
<T as Lift<'tcx>>::Lifted: TypeFoldable<'tcx>,
456+
<T as Lift<'tcx>>::Lifted: TypeVisitable<'tcx>,
457457
{
458458
type Lifted = ty::Binder<'tcx, T::Lifted>;
459459
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {

Diff for: compiler/rustc_middle/src/ty/sty.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::ty::subst::{GenericArg, InternalSubsts, Subst, SubstsRef};
88
use crate::ty::InferTy::*;
99
use crate::ty::{
1010
self, AdtDef, DefIdTree, Discr, Term, Ty, TyCtxt, TypeFlags, TypeFoldable, TypeSuperFoldable,
11-
TypeVisitor,
11+
TypeVisitable, TypeVisitor,
1212
};
1313
use crate::ty::{List, ParamEnv};
1414
use polonius_engine::Atom;
@@ -986,7 +986,7 @@ pub struct Binder<'tcx, T>(T, &'tcx List<BoundVariableKind>);
986986

987987
impl<'tcx, T> Binder<'tcx, T>
988988
where
989-
T: TypeFoldable<'tcx>,
989+
T: TypeVisitable<'tcx>,
990990
{
991991
/// Wraps `value` in a binder, asserting that `value` does not
992992
/// contain any bound vars that would be bound by the
@@ -1050,14 +1050,14 @@ impl<'tcx, T> Binder<'tcx, T> {
10501050
Binder(value, self.1)
10511051
}
10521052

1053-
pub fn map_bound_ref<F, U: TypeFoldable<'tcx>>(&self, f: F) -> Binder<'tcx, U>
1053+
pub fn map_bound_ref<F, U: TypeVisitable<'tcx>>(&self, f: F) -> Binder<'tcx, U>
10541054
where
10551055
F: FnOnce(&T) -> U,
10561056
{
10571057
self.as_ref().map_bound(f)
10581058
}
10591059

1060-
pub fn map_bound<F, U: TypeFoldable<'tcx>>(self, f: F) -> Binder<'tcx, U>
1060+
pub fn map_bound<F, U: TypeVisitable<'tcx>>(self, f: F) -> Binder<'tcx, U>
10611061
where
10621062
F: FnOnce(T) -> U,
10631063
{
@@ -1069,7 +1069,7 @@ impl<'tcx, T> Binder<'tcx, T> {
10691069
Binder(value, self.1)
10701070
}
10711071

1072-
pub fn try_map_bound<F, U: TypeFoldable<'tcx>, E>(self, f: F) -> Result<Binder<'tcx, U>, E>
1072+
pub fn try_map_bound<F, U: TypeVisitable<'tcx>, E>(self, f: F) -> Result<Binder<'tcx, U>, E>
10731073
where
10741074
F: FnOnce(T) -> Result<U, E>,
10751075
{
@@ -1092,7 +1092,7 @@ impl<'tcx, T> Binder<'tcx, T> {
10921092
/// in `bind`. This may be (debug) asserted in the future.
10931093
pub fn rebind<U>(&self, value: U) -> Binder<'tcx, U>
10941094
where
1095-
U: TypeFoldable<'tcx>,
1095+
U: TypeVisitable<'tcx>,
10961096
{
10971097
if cfg!(debug_assertions) {
10981098
let mut validator = ValidateBoundVars::new(self.bound_vars());
@@ -1113,7 +1113,7 @@ impl<'tcx, T> Binder<'tcx, T> {
11131113
/// would not be that useful.)
11141114
pub fn no_bound_vars(self) -> Option<T>
11151115
where
1116-
T: TypeFoldable<'tcx>,
1116+
T: TypeVisitable<'tcx>,
11171117
{
11181118
if self.0.has_escaping_bound_vars() { None } else { Some(self.skip_binder()) }
11191119
}

Diff for: compiler/rustc_privacy/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ use rustc_middle::thir::abstract_const::Node as ACNode;
2727
use rustc_middle::ty::query::Providers;
2828
use rustc_middle::ty::subst::InternalSubsts;
2929
use rustc_middle::ty::{self, Const, DefIdTree, GenericParamDefKind};
30-
use rustc_middle::ty::{TraitRef, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitor};
30+
use rustc_middle::ty::{
31+
TraitRef, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitor,
32+
};
3133
use rustc_session::lint;
3234
use rustc_span::hygiene::Transparency;
3335
use rustc_span::symbol::{kw, Ident};
@@ -80,7 +82,7 @@ trait DefIdVisitor<'tcx> {
8082
dummy: Default::default(),
8183
}
8284
}
83-
fn visit(&mut self, ty_fragment: impl TypeFoldable<'tcx>) -> ControlFlow<Self::BreakTy> {
85+
fn visit(&mut self, ty_fragment: impl TypeVisitable<'tcx>) -> ControlFlow<Self::BreakTy> {
8486
ty_fragment.visit_with(&mut self.skeleton())
8587
}
8688
fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> ControlFlow<Self::BreakTy> {

Diff for: compiler/rustc_symbol_mangling/src/v0.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::layout::IntegerExt;
99
use rustc_middle::ty::print::{Print, Printer};
1010
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, Subst};
1111
use rustc_middle::ty::{
12-
self, EarlyBinder, FloatTy, Instance, IntTy, Ty, TyCtxt, TypeFoldable, UintTy,
12+
self, EarlyBinder, FloatTy, Instance, IntTy, Ty, TyCtxt, TypeFoldable, TypeVisitable, UintTy,
1313
};
1414
use rustc_span::symbol::kw;
1515
use rustc_target::abi::call::FnAbi;
@@ -240,7 +240,7 @@ impl<'tcx> SymbolMangler<'tcx> {
240240
print_value: impl FnOnce(&'a mut Self, &T) -> Result<&'a mut Self, !>,
241241
) -> Result<&'a mut Self, !>
242242
where
243-
T: TypeFoldable<'tcx>,
243+
T: TypeVisitable<'tcx>,
244244
{
245245
let regions = if value.has_late_bound_regions() {
246246
self.tcx.collect_referenced_late_bound_regions(value)

Diff for: compiler/rustc_trait_selection/src/traits/object_safety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc_hir as hir;
1919
use rustc_hir::def_id::DefId;
2020
use rustc_middle::ty::subst::{GenericArg, InternalSubsts, Subst};
2121
use rustc_middle::ty::{
22-
self, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitor,
22+
self, EarlyBinder, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitor,
2323
};
2424
use rustc_middle::ty::{Predicate, ToPredicate};
2525
use rustc_session::lint::builtin::WHERE_CLAUSES_OBJECT_SAFETY;
@@ -731,7 +731,7 @@ fn receiver_is_dispatchable<'tcx>(
731731
})
732732
}
733733

734-
fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
734+
fn contains_illegal_self_type_reference<'tcx, T: TypeVisitable<'tcx>>(
735735
tcx: TyCtxt<'tcx>,
736736
trait_def_id: DefId,
737737
value: T,

Diff for: compiler/rustc_trait_selection/src/traits/project.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use rustc_infer::infer::resolve::OpportunisticRegionResolver;
3131
use rustc_middle::traits::select::OverflowError;
3232
use rustc_middle::ty::fold::{MaxUniverse, TypeFoldable, TypeFolder, TypeSuperFoldable};
3333
use rustc_middle::ty::subst::Subst;
34+
use rustc_middle::ty::visit::TypeVisitable;
3435
use rustc_middle::ty::{self, EarlyBinder, Term, ToPredicate, Ty, TyCtxt};
3536
use rustc_span::symbol::sym;
3637

@@ -359,7 +360,7 @@ where
359360
result
360361
}
361362

362-
pub(crate) fn needs_normalization<'tcx, T: TypeFoldable<'tcx>>(value: &T, reveal: Reveal) -> bool {
363+
pub(crate) fn needs_normalization<'tcx, T: TypeVisitable<'tcx>>(value: &T, reveal: Reveal) -> bool {
363364
match reveal {
364365
Reveal::UserFacing => value
365366
.has_type_flags(ty::TypeFlags::HAS_TY_PROJECTION | ty::TypeFlags::HAS_CT_PROJECTION),

Diff for: compiler/rustc_trait_selection/src/traits/query/normalize.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use rustc_infer::traits::Normalized;
1414
use rustc_middle::mir;
1515
use rustc_middle::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
1616
use rustc_middle::ty::subst::Subst;
17+
use rustc_middle::ty::visit::TypeVisitable;
1718
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor};
1819

1920
use std::ops::ControlFlow;
@@ -108,7 +109,7 @@ struct MaxEscapingBoundVarVisitor {
108109
}
109110

110111
impl<'tcx> TypeVisitor<'tcx> for MaxEscapingBoundVarVisitor {
111-
fn visit_binder<T: TypeFoldable<'tcx>>(
112+
fn visit_binder<T: TypeVisitable<'tcx>>(
112113
&mut self,
113114
t: &ty::Binder<'tcx, T>,
114115
) -> ControlFlow<Self::BreakTy> {

Diff for: compiler/rustc_traits/src/chalk/lowering.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ use rustc_ast::ast;
3535
use rustc_middle::traits::{ChalkEnvironmentAndGoal, ChalkRustInterner as RustInterner};
3636
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
3737
use rustc_middle::ty::{
38-
self, Binder, Region, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitor,
38+
self, Binder, Region, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitable,
39+
TypeVisitor,
3940
};
4041
use rustc_span::def_id::DefId;
4142

@@ -896,7 +897,7 @@ impl<'tcx> BoundVarsCollector<'tcx> {
896897
}
897898

898899
impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
899-
fn visit_binder<T: TypeFoldable<'tcx>>(
900+
fn visit_binder<T: TypeVisitable<'tcx>>(
900901
&mut self,
901902
t: &Binder<'tcx, T>,
902903
) -> ControlFlow<Self::BreakTy> {

Diff for: compiler/rustc_ty_utils/src/instance.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_infer::infer::TyCtxtInferExt;
44
use rustc_middle::traits::CodegenObligationError;
55
use rustc_middle::ty::subst::SubstsRef;
66
use rustc_middle::ty::{
7-
self, Binder, Instance, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitor,
7+
self, Binder, Instance, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitor,
88
};
99
use rustc_span::{sym, DUMMY_SP};
1010
use rustc_trait_selection::traits;
@@ -56,7 +56,7 @@ impl<'tcx> BoundVarsCollector<'tcx> {
5656
impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
5757
type BreakTy = ();
5858

59-
fn visit_binder<T: TypeFoldable<'tcx>>(
59+
fn visit_binder<T: TypeVisitable<'tcx>>(
6060
&mut self,
6161
t: &Binder<'tcx, T>,
6262
) -> ControlFlow<Self::BreakTy> {

Diff for: compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use rustc_middle::ty::fold::TypeFoldable;
2323
use rustc_middle::ty::subst::{
2424
self, GenericArgKind, InternalSubsts, Subst, SubstsRef, UserSelfTy, UserSubsts,
2525
};
26+
use rustc_middle::ty::visit::TypeVisitable;
2627
use rustc_middle::ty::{
2728
self, AdtKind, CanonicalUserType, DefIdTree, EarlyBinder, GenericParamDefKind, ToPolyTraitRef,
2829
ToPredicate, Ty, UserType,
@@ -557,7 +558,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
557558
// sufficiently enforced with erased regions. =)
558559
fn can_contain_user_lifetime_bounds<T>(t: T) -> bool
559560
where
560-
T: TypeFoldable<'tcx>,
561+
T: TypeVisitable<'tcx>,
561562
{
562563
t.has_free_regions() || t.has_projections() || t.has_infer_types()
563564
}

0 commit comments

Comments
 (0)