Skip to content

Commit 6bb470e

Browse files
committed
introduce ty::WhereClause to align chalk and rustc dyn repr
1 parent f820d9d commit 6bb470e

File tree

30 files changed

+95
-120
lines changed

30 files changed

+95
-120
lines changed

compiler/rustc_const_eval/src/interpret/intrinsics/type_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
7474

7575
fn print_dyn_existential(
7676
mut self,
77-
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
77+
predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
7878
) -> Result<Self::DynExistential, Self::Error> {
7979
let mut first = true;
8080
for p in predicates {

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,10 @@ impl Checker<'mir, 'tcx> {
376376
ty::Dynamic(preds, _) => {
377377
for pred in preds.iter() {
378378
match pred.skip_binder() {
379-
ty::ExistentialPredicate::AutoTrait(_)
380-
| ty::ExistentialPredicate::Projection(_) => {
379+
ty::WhereClause::AutoTrait(_) | ty::WhereClause::Projection(_) => {
381380
self.check_op(ops::ty::DynTrait(kind))
382381
}
383-
ty::ExistentialPredicate::Trait(trait_ref) => {
382+
ty::WhereClause::Trait(trait_ref) => {
384383
if Some(trait_ref.def_id) != self.tcx.lang_items().sized_trait() {
385384
self.check_op(ops::ty::DynTrait(kind))
386385
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
482482

483483
fn print_dyn_existential(
484484
self,
485-
_predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
485+
_predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
486486
) -> Result<Self::DynExistential, Self::Error> {
487487
Err(NonTrivialPath)
488488
}

compiler/rustc_lint/src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ impl<'tcx> LateContext<'tcx> {
994994

995995
fn print_dyn_existential(
996996
self,
997-
_predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
997+
_predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
998998
) -> Result<Self::DynExistential, Self::Error> {
999999
Ok(())
10001000
}

compiler/rustc_lint/src/unused.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
222222
ty::Dynamic(binder, _) => {
223223
let mut has_emitted = false;
224224
for predicate in binder.iter() {
225-
if let ty::ExistentialPredicate::Trait(ref trait_ref) =
226-
predicate.skip_binder()
227-
{
225+
if let ty::WhereClause::Trait(ref trait_ref) = predicate.skip_binder() {
228226
let def_id = trait_ref.def_id;
229227
let descr_post =
230228
&format!(" trait object{}{}", plural_suffix, descr_post,);

compiler/rustc_middle/src/ty/codec.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,7 @@ impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<Ty<'tcx>> {
322322
}
323323
}
324324

325-
impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D>
326-
for ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>
327-
{
325+
impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<ty::ExistentialPredicate<'tcx>> {
328326
fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
329327
let len = decoder.read_usize()?;
330328
decoder.tcx().mk_poly_existential_predicates((0..len).map(|_| Decodable::decode(decoder)))
@@ -393,7 +391,7 @@ impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for ty::List<ty::BoundVaria
393391
impl_decodable_via_ref! {
394392
&'tcx ty::TypeckResults<'tcx>,
395393
&'tcx ty::List<Ty<'tcx>>,
396-
&'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
394+
&'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
397395
&'tcx Allocation,
398396
&'tcx mir::Body<'tcx>,
399397
&'tcx mir::UnsafetyCheckResult,
@@ -519,7 +517,7 @@ macro_rules! impl_binder_encode_decode {
519517
impl_binder_encode_decode! {
520518
&'tcx ty::List<Ty<'tcx>>,
521519
ty::FnSig<'tcx>,
522-
ty::ExistentialPredicate<'tcx>,
520+
ty::WhereClause<'tcx>,
523521
ty::TraitRef<'tcx>,
524522
Vec<ty::GeneratorInteriorTypeCause<'tcx>>,
525523
}

compiler/rustc_middle/src/ty/context.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ pub struct CtxtInterners<'tcx> {
103103
substs: InternedSet<'tcx, InternalSubsts<'tcx>>,
104104
canonical_var_infos: InternedSet<'tcx, List<CanonicalVarInfo<'tcx>>>,
105105
region: InternedSet<'tcx, RegionKind>,
106-
poly_existential_predicates:
107-
InternedSet<'tcx, List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>>>,
106+
poly_existential_predicates: InternedSet<'tcx, List<ExistentialPredicate<'tcx>>>,
108107
predicate: InternedSet<'tcx, PredicateInner<'tcx>>,
109108
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
110109
projs: InternedSet<'tcx, List<ProjectionKind>>,
@@ -1672,7 +1671,7 @@ nop_lift! {const_allocation; &'a Allocation => &'tcx Allocation}
16721671
nop_lift! {predicate; &'a PredicateInner<'a> => &'tcx PredicateInner<'tcx>}
16731672

16741673
nop_list_lift! {type_list; Ty<'a> => Ty<'tcx>}
1675-
nop_list_lift! {poly_existential_predicates; ty::Binder<'a, ExistentialPredicate<'a>> => ty::Binder<'tcx, ExistentialPredicate<'tcx>>}
1674+
nop_list_lift! {poly_existential_predicates; ExistentialPredicate<'a> => ExistentialPredicate<'tcx>}
16761675
nop_list_lift! {predicates; Predicate<'a> => Predicate<'tcx>}
16771676
nop_list_lift! {canonical_var_infos; CanonicalVarInfo<'a> => CanonicalVarInfo<'tcx>}
16781677
nop_list_lift! {projs; ProjectionKind => ProjectionKind}
@@ -2109,7 +2108,7 @@ slice_interners!(
21092108
substs: _intern_substs(GenericArg<'tcx>),
21102109
canonical_var_infos: _intern_canonical_var_infos(CanonicalVarInfo<'tcx>),
21112110
poly_existential_predicates:
2112-
_intern_poly_existential_predicates(ty::Binder<'tcx, ExistentialPredicate<'tcx>>),
2111+
_intern_poly_existential_predicates(ty::ExistentialPredicate<'tcx>),
21132112
predicates: _intern_predicates(Predicate<'tcx>),
21142113
projs: _intern_projs(ProjectionKind),
21152114
place_elems: _intern_place_elems(PlaceElem<'tcx>),
@@ -2372,7 +2371,7 @@ impl<'tcx> TyCtxt<'tcx> {
23722371
#[inline]
23732372
pub fn mk_dynamic(
23742373
self,
2375-
obj: &'tcx List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>>,
2374+
obj: &'tcx List<ExistentialPredicate<'tcx>>,
23762375
reg: ty::Region<'tcx>,
23772376
) -> Ty<'tcx> {
23782377
self.mk_ty(Dynamic(obj, reg))
@@ -2504,8 +2503,8 @@ impl<'tcx> TyCtxt<'tcx> {
25042503

25052504
pub fn intern_poly_existential_predicates(
25062505
self,
2507-
eps: &[ty::Binder<'tcx, ExistentialPredicate<'tcx>>],
2508-
) -> &'tcx List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> {
2506+
eps: &[ty::ExistentialPredicate<'tcx>],
2507+
) -> &'tcx List<ExistentialPredicate<'tcx>> {
25092508
assert!(!eps.is_empty());
25102509
assert!(
25112510
eps.array_windows()
@@ -2577,10 +2576,7 @@ impl<'tcx> TyCtxt<'tcx> {
25772576
}
25782577

25792578
pub fn mk_poly_existential_predicates<
2580-
I: InternAs<
2581-
[ty::Binder<'tcx, ExistentialPredicate<'tcx>>],
2582-
&'tcx List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>>,
2583-
>,
2579+
I: InternAs<[ExistentialPredicate<'tcx>], &'tcx List<ExistentialPredicate<'tcx>>>,
25842580
>(
25852581
self,
25862582
iter: I,

compiler/rustc_middle/src/ty/error.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ pub enum TypeError<'tcx> {
6262
CyclicTy(Ty<'tcx>),
6363
CyclicConst(&'tcx ty::Const<'tcx>),
6464
ProjectionMismatched(ExpectedFound<DefId>),
65-
ExistentialMismatch(
66-
ExpectedFound<&'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>>,
67-
),
65+
ExistentialMismatch(ExpectedFound<&'tcx ty::List<ty::ExistentialPredicate<'tcx>>>),
6866
ObjectUnsafeCoercion(DefId),
6967
ConstMismatch(ExpectedFound<&'tcx ty::Const<'tcx>>),
7068

compiler/rustc_middle/src/ty/flags.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ impl FlagComputation {
174174
&ty::Dynamic(obj, r) => {
175175
for predicate in obj.iter() {
176176
self.bound_computation(predicate, |computation, predicate| match predicate {
177-
ty::ExistentialPredicate::Trait(tr) => computation.add_substs(tr.substs),
178-
ty::ExistentialPredicate::Projection(p) => {
177+
ty::WhereClause::Trait(tr) => computation.add_substs(tr.substs),
178+
ty::WhereClause::Projection(p) => {
179179
computation.add_existential_projection(&p);
180180
}
181-
ty::ExistentialPredicate::AutoTrait(_) => {}
181+
ty::WhereClause::AutoTrait(_) => {}
182182
});
183183
}
184184

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub use self::sty::{
7777
GeneratorSubsts, GeneratorSubstsParts, InlineConstSubsts, InlineConstSubstsParts, ParamConst,
7878
ParamTy, PolyExistentialProjection, PolyExistentialTraitRef, PolyFnSig, PolyGenSig,
7979
PolyTraitRef, ProjectionTy, Region, RegionKind, RegionVid, TraitRef, TyKind, TypeAndMut,
80-
UpvarSubsts, VarianceDiagInfo, VarianceDiagMutKind,
80+
UpvarSubsts, VarianceDiagInfo, VarianceDiagMutKind, WhereClause,
8181
};
8282
pub use self::trait_def::TraitDef;
8383

compiler/rustc_middle/src/ty/print/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub trait Printer<'tcx>: Sized {
6363

6464
fn print_dyn_existential(
6565
self,
66-
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
66+
predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
6767
) -> Result<Self::DynExistential, Self::Error>;
6868

6969
fn print_const(self, ct: &'tcx ty::Const<'tcx>) -> Result<Self::Const, Self::Error>;
@@ -345,9 +345,7 @@ impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for Ty<'tcx> {
345345
}
346346
}
347347

348-
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P>
349-
for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>
350-
{
348+
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for &'tcx ty::List<ty::ExistentialPredicate<'tcx>> {
351349
type Output = P::DynExistential;
352350
type Error = P::Error;
353351
fn print(&self, cx: P) -> Result<Self::Output, Self::Error> {

compiler/rustc_middle/src/ty/print/pretty.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ pub trait PrettyPrinter<'tcx>:
800800

801801
fn pretty_print_dyn_existential(
802802
mut self,
803-
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
803+
predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
804804
) -> Result<Self::DynExistential, Self::Error> {
805805
// Generate the main trait ref, including associated types.
806806
let mut first = true;
@@ -1484,7 +1484,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
14841484

14851485
fn print_dyn_existential(
14861486
self,
1487-
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
1487+
predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
14881488
) -> Result<Self::DynExistential, Self::Error> {
14891489
self.pretty_print_dyn_existential(predicates)
14901490
}
@@ -2210,12 +2210,12 @@ impl ty::Binder<'tcx, ty::TraitRef<'tcx>> {
22102210

22112211
forward_display_to_print! {
22122212
Ty<'tcx>,
2213-
&'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
2213+
&'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
22142214
&'tcx ty::Const<'tcx>,
22152215

22162216
// HACK(eddyb) these are exhaustive instead of generic,
22172217
// because `for<'tcx>` isn't possible yet.
2218-
ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>,
2218+
ty::Binder<'tcx, ty::WhereClause<'tcx>>,
22192219
ty::Binder<'tcx, ty::TraitRef<'tcx>>,
22202220
ty::Binder<'tcx, ty::ExistentialTraitRef<'tcx>>,
22212221
ty::Binder<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>,
@@ -2254,11 +2254,11 @@ define_print_and_forward_display! {
22542254
p!(write("{} = ", name), print(self.ty))
22552255
}
22562256

2257-
ty::ExistentialPredicate<'tcx> {
2257+
ty::WhereClause<'tcx> {
22582258
match *self {
2259-
ty::ExistentialPredicate::Trait(x) => p!(print(x)),
2260-
ty::ExistentialPredicate::Projection(x) => p!(print(x)),
2261-
ty::ExistentialPredicate::AutoTrait(def_id) => {
2259+
ty::WhereClause::Trait(x) => p!(print(x)),
2260+
ty::WhereClause::Projection(x) => p!(print(x)),
2261+
ty::WhereClause::AutoTrait(def_id) => {
22622262
p!(print_def_path(def_id, &[]));
22632263
}
22642264
}

compiler/rustc_middle/src/ty/relate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ fn check_const_value_eq<R: TypeRelation<'tcx>>(
672672
})
673673
}
674674

675-
impl<'tcx> Relate<'tcx> for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>> {
675+
impl<'tcx> Relate<'tcx> for &'tcx ty::List<ty::ExistentialPredicate<'tcx>> {
676676
fn relate<R: TypeRelation<'tcx>>(
677677
relation: &mut R,
678678
a: Self,
@@ -695,7 +695,7 @@ impl<'tcx> Relate<'tcx> for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredi
695695
}
696696

697697
let v = iter::zip(a_v, b_v).map(|(ep_a, ep_b)| {
698-
use crate::ty::ExistentialPredicate::*;
698+
use ty::WhereClause::*;
699699
match (ep_a.skip_binder(), ep_b.skip_binder()) {
700700
(Trait(a), Trait(b)) => Ok(ep_a
701701
.rebind(Trait(relation.relate(ep_a.rebind(a), ep_b.rebind(b))?.skip_binder()))),

compiler/rustc_middle/src/ty/structural_impls.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,13 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> {
347347
}
348348
}
349349

350-
impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> {
351-
type Lifted = ty::ExistentialPredicate<'tcx>;
350+
impl<'a, 'tcx> Lift<'tcx> for ty::WhereClause<'a> {
351+
type Lifted = ty::WhereClause<'tcx>;
352352
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
353353
match self {
354-
ty::ExistentialPredicate::Trait(x) => tcx.lift(x).map(ty::ExistentialPredicate::Trait),
355-
ty::ExistentialPredicate::Projection(x) => {
356-
tcx.lift(x).map(ty::ExistentialPredicate::Projection)
357-
}
358-
ty::ExistentialPredicate::AutoTrait(def_id) => {
359-
Some(ty::ExistentialPredicate::AutoTrait(def_id))
360-
}
354+
ty::WhereClause::Trait(x) => tcx.lift(x).map(ty::WhereClause::Trait),
355+
ty::WhereClause::Projection(x) => tcx.lift(x).map(ty::WhereClause::Projection),
356+
ty::WhereClause::AutoTrait(def_id) => Some(ty::WhereClause::AutoTrait(def_id)),
361357
}
362358
}
363359
}
@@ -787,7 +783,7 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for ty::Binder<'tcx, T> {
787783
}
788784
}
789785

790-
impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>> {
786+
impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<ty::ExistentialPredicate<'tcx>> {
791787
fn super_fold_with<F: TypeFolder<'tcx>>(self, folder: &mut F) -> Self {
792788
ty::util::fold_list(self, folder, |tcx, v| tcx.intern_poly_existential_predicates(v))
793789
}

compiler/rustc_middle/src/ty/sty.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub enum TyKind<'tcx> {
150150
FnPtr(PolyFnSig<'tcx>),
151151

152152
/// A trait object. Written as `dyn for<'b> Trait<'b, Assoc = u32> + Send + 'a`.
153-
Dynamic(&'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>, ty::Region<'tcx>),
153+
Dynamic(&'tcx List<ExistentialPredicate<'tcx>>, ty::Region<'tcx>),
154154

155155
/// The anonymous type of a closure. Used to represent the type of
156156
/// `|a| a`.
@@ -766,7 +766,7 @@ impl<'tcx> InlineConstSubsts<'tcx> {
766766

767767
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, TyEncodable, TyDecodable)]
768768
#[derive(HashStable, TypeFoldable)]
769-
pub enum ExistentialPredicate<'tcx> {
769+
pub enum WhereClause<'tcx> {
770770
/// E.g., `Iterator`.
771771
Trait(ExistentialTraitRef<'tcx>),
772772
/// E.g., `Iterator::Item = T`.
@@ -775,11 +775,13 @@ pub enum ExistentialPredicate<'tcx> {
775775
AutoTrait(DefId),
776776
}
777777

778-
impl<'tcx> ExistentialPredicate<'tcx> {
778+
pub type ExistentialPredicate<'tcx> = Binder<'tcx, WhereClause<'tcx>>;
779+
780+
impl<'tcx> WhereClause<'tcx> {
779781
/// Compares via an ordering that will not change if modules are reordered or other changes are
780782
/// made to the tree. In particular, this ordering is preserved across incremental compilations.
781783
pub fn stable_cmp(&self, tcx: TyCtxt<'tcx>, other: &Self) -> Ordering {
782-
use self::ExistentialPredicate::*;
784+
use WhereClause::*;
783785
match (*self, *other) {
784786
(Trait(_), Trait(_)) => Ordering::Equal,
785787
(Projection(ref a), Projection(ref b)) => {
@@ -796,17 +798,17 @@ impl<'tcx> ExistentialPredicate<'tcx> {
796798
}
797799
}
798800

799-
impl<'tcx> Binder<'tcx, ExistentialPredicate<'tcx>> {
801+
impl<'tcx> ExistentialPredicate<'tcx> {
800802
pub fn with_self_ty(&self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> {
801803
use crate::ty::ToPredicate;
802804
match self.skip_binder() {
803-
ExistentialPredicate::Trait(tr) => {
805+
WhereClause::Trait(tr) => {
804806
self.rebind(tr).with_self_ty(tcx, self_ty).without_const().to_predicate(tcx)
805807
}
806-
ExistentialPredicate::Projection(p) => {
808+
WhereClause::Projection(p) => {
807809
self.rebind(p.with_self_ty(tcx, self_ty)).to_predicate(tcx)
808810
}
809-
ExistentialPredicate::AutoTrait(did) => {
811+
WhereClause::AutoTrait(did) => {
810812
let trait_ref = self.rebind(ty::TraitRef {
811813
def_id: did,
812814
substs: tcx.mk_substs_trait(self_ty, &[]),
@@ -817,7 +819,7 @@ impl<'tcx> Binder<'tcx, ExistentialPredicate<'tcx>> {
817819
}
818820
}
819821

820-
impl<'tcx> List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> {
822+
impl<'tcx> List<ExistentialPredicate<'tcx>> {
821823
/// Returns the "principal `DefId`" of this set of existential predicates.
822824
///
823825
/// A Rust trait object type consists (in addition to a lifetime bound)
@@ -846,7 +848,7 @@ impl<'tcx> List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> {
846848
pub fn principal(&self) -> Option<ty::Binder<'tcx, ExistentialTraitRef<'tcx>>> {
847849
self[0]
848850
.map_bound(|this| match this {
849-
ExistentialPredicate::Trait(tr) => Some(tr),
851+
WhereClause::Trait(tr) => Some(tr),
850852
_ => None,
851853
})
852854
.transpose()
@@ -863,7 +865,7 @@ impl<'tcx> List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> {
863865
self.iter().filter_map(|predicate| {
864866
predicate
865867
.map_bound(|pred| match pred {
866-
ExistentialPredicate::Projection(projection) => Some(projection),
868+
WhereClause::Projection(projection) => Some(projection),
867869
_ => None,
868870
})
869871
.transpose()
@@ -873,7 +875,7 @@ impl<'tcx> List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> {
873875
#[inline]
874876
pub fn auto_traits<'a>(&'a self) -> impl Iterator<Item = DefId> + 'a {
875877
self.iter().filter_map(|predicate| match predicate.skip_binder() {
876-
ExistentialPredicate::AutoTrait(did) => Some(did),
878+
WhereClause::AutoTrait(did) => Some(did),
877879
_ => None,
878880
})
879881
}

compiler/rustc_middle/src/ty/walk.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ fn push_inner<'tcx>(
171171
stack.push(lt.into());
172172
stack.extend(obj.iter().rev().flat_map(|predicate| {
173173
let (substs, opt_ty) = match predicate.skip_binder() {
174-
ty::ExistentialPredicate::Trait(tr) => (tr.substs, None),
175-
ty::ExistentialPredicate::Projection(p) => (p.substs, Some(p.ty)),
176-
ty::ExistentialPredicate::AutoTrait(_) =>
174+
ty::WhereClause::Trait(tr) => (tr.substs, None),
175+
ty::WhereClause::Projection(p) => (p.substs, Some(p.ty)),
176+
ty::WhereClause::AutoTrait(_) =>
177177
// Empty iterator
178178
{
179179
(ty::InternalSubsts::empty(), None)

0 commit comments

Comments
 (0)