drive-by: PolyExistentialPredicate

This commit is contained in:
Michael Goulet 2022-11-19 03:28:56 +00:00
parent ff0ffda6b3
commit c36ff28d42
20 changed files with 48 additions and 53 deletions

View File

@ -74,7 +74,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
fn print_dyn_existential( fn print_dyn_existential(
self, self,
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error> { ) -> Result<Self::DynExistential, Self::Error> {
self.pretty_print_dyn_existential(predicates) self.pretty_print_dyn_existential(predicates)
} }

View File

@ -3019,7 +3019,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
fn compute_object_lifetime_bound( fn compute_object_lifetime_bound(
&self, &self,
span: Span, span: Span,
existential_predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, existential_predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Option<ty::Region<'tcx>> // if None, use the default ) -> Option<ty::Region<'tcx>> // if None, use the default
{ {
let tcx = self.tcx(); let tcx = self.tcx();

View File

@ -748,7 +748,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
&self, &self,
a: Ty<'tcx>, a: Ty<'tcx>,
b: Ty<'tcx>, b: Ty<'tcx>,
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
b_region: ty::Region<'tcx>, b_region: ty::Region<'tcx>,
) -> CoerceResult<'tcx> { ) -> CoerceResult<'tcx> {
if !self.tcx.features().dyn_star { if !self.tcx.features().dyn_star {

View File

@ -542,7 +542,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
fn print_dyn_existential( fn print_dyn_existential(
self, self,
_predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, _predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error> { ) -> Result<Self::DynExistential, Self::Error> {
Err(NonTrivialPath) Err(NonTrivialPath)
} }

View File

@ -1159,7 +1159,7 @@ impl<'tcx> LateContext<'tcx> {
fn print_dyn_existential( fn print_dyn_existential(
self, self,
_predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, _predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error> { ) -> Result<Self::DynExistential, Self::Error> {
Ok(()) Ok(())
} }

View File

@ -298,7 +298,7 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> for ty::List<Ty
} }
impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D>
for ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>> for ty::List<ty::PolyExistentialPredicate<'tcx>>
{ {
fn decode(decoder: &mut D) -> &'tcx Self { fn decode(decoder: &mut D) -> &'tcx Self {
let len = decoder.read_usize(); let len = decoder.read_usize();
@ -379,7 +379,7 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D>
impl_decodable_via_ref! { impl_decodable_via_ref! {
&'tcx ty::TypeckResults<'tcx>, &'tcx ty::TypeckResults<'tcx>,
&'tcx ty::List<Ty<'tcx>>, &'tcx ty::List<Ty<'tcx>>,
&'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
&'tcx traits::ImplSource<'tcx, ()>, &'tcx traits::ImplSource<'tcx, ()>,
&'tcx mir::Body<'tcx>, &'tcx mir::Body<'tcx>,
&'tcx mir::UnsafetyCheckResult, &'tcx mir::UnsafetyCheckResult,

View File

@ -17,11 +17,11 @@ use crate::traits;
use crate::ty::query::{self, TyCtxtAt}; use crate::ty::query::{self, TyCtxtAt};
use crate::ty::{ use crate::ty::{
self, AdtDef, AdtDefData, AdtKind, Binder, BindingMode, BoundVar, CanonicalPolyFnSig, self, AdtDef, AdtDefData, AdtKind, Binder, BindingMode, BoundVar, CanonicalPolyFnSig,
ClosureSizeProfileData, Const, ConstS, ConstVid, DefIdTree, ExistentialPredicate, FloatTy, ClosureSizeProfileData, Const, ConstS, ConstVid, DefIdTree, FloatTy, FloatVar, FloatVid,
FloatVar, FloatVid, GenericParamDefKind, InferConst, InferTy, IntTy, IntVar, IntVid, List, GenericParamDefKind, InferConst, InferTy, IntTy, IntVar, IntVid, List, ParamConst, ParamTy,
ParamConst, ParamTy, PolyFnSig, Predicate, PredicateKind, PredicateS, ProjectionTy, Region, PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind, PredicateS, ProjectionTy,
RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut, UintTy, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut,
Visibility, UintTy, Visibility,
}; };
use crate::ty::{GenericArg, GenericArgKind, InternalSubsts, SubstsRef, UserSubsts}; use crate::ty::{GenericArg, GenericArgKind, InternalSubsts, SubstsRef, UserSubsts};
use rustc_ast as ast; use rustc_ast as ast;
@ -109,7 +109,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
type Mutability = hir::Mutability; type Mutability = hir::Mutability;
type Movability = hir::Movability; type Movability = hir::Movability;
type PolyFnSig = PolyFnSig<'tcx>; type PolyFnSig = PolyFnSig<'tcx>;
type ListBinderExistentialPredicate = &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>; type ListBinderExistentialPredicate = &'tcx List<PolyExistentialPredicate<'tcx>>;
type BinderListTy = Binder<'tcx, &'tcx List<Ty<'tcx>>>; type BinderListTy = Binder<'tcx, &'tcx List<Ty<'tcx>>>;
type ListTy = &'tcx List<Ty<'tcx>>; type ListTy = &'tcx List<Ty<'tcx>>;
type ProjectionTy = ty::ProjectionTy<'tcx>; type ProjectionTy = ty::ProjectionTy<'tcx>;
@ -140,8 +140,7 @@ pub struct CtxtInterners<'tcx> {
substs: InternedSet<'tcx, InternalSubsts<'tcx>>, substs: InternedSet<'tcx, InternalSubsts<'tcx>>,
canonical_var_infos: InternedSet<'tcx, List<CanonicalVarInfo<'tcx>>>, canonical_var_infos: InternedSet<'tcx, List<CanonicalVarInfo<'tcx>>>,
region: InternedSet<'tcx, RegionKind<'tcx>>, region: InternedSet<'tcx, RegionKind<'tcx>>,
poly_existential_predicates: poly_existential_predicates: InternedSet<'tcx, List<PolyExistentialPredicate<'tcx>>>,
InternedSet<'tcx, List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>>>,
predicate: InternedSet<'tcx, PredicateS<'tcx>>, predicate: InternedSet<'tcx, PredicateS<'tcx>>,
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>, predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
projs: InternedSet<'tcx, List<ProjectionKind>>, projs: InternedSet<'tcx, List<ProjectionKind>>,
@ -1810,7 +1809,7 @@ nop_lift! {const_; Const<'a> => Const<'tcx>}
nop_lift! {const_allocation; ConstAllocation<'a> => ConstAllocation<'tcx>} nop_lift! {const_allocation; ConstAllocation<'a> => ConstAllocation<'tcx>}
nop_lift! {predicate; Predicate<'a> => Predicate<'tcx>} nop_lift! {predicate; Predicate<'a> => Predicate<'tcx>}
nop_list_lift! {poly_existential_predicates; ty::Binder<'a, ExistentialPredicate<'a>> => ty::Binder<'tcx, ExistentialPredicate<'tcx>>} nop_list_lift! {poly_existential_predicates; PolyExistentialPredicate<'a> => PolyExistentialPredicate<'tcx>}
nop_list_lift! {predicates; Predicate<'a> => Predicate<'tcx>} nop_list_lift! {predicates; Predicate<'a> => Predicate<'tcx>}
nop_list_lift! {canonical_var_infos; CanonicalVarInfo<'a> => CanonicalVarInfo<'tcx>} nop_list_lift! {canonical_var_infos; CanonicalVarInfo<'a> => CanonicalVarInfo<'tcx>}
nop_list_lift! {projs; ProjectionKind => ProjectionKind} nop_list_lift! {projs; ProjectionKind => ProjectionKind}
@ -2265,7 +2264,7 @@ slice_interners!(
substs: _intern_substs(GenericArg<'tcx>), substs: _intern_substs(GenericArg<'tcx>),
canonical_var_infos: _intern_canonical_var_infos(CanonicalVarInfo<'tcx>), canonical_var_infos: _intern_canonical_var_infos(CanonicalVarInfo<'tcx>),
poly_existential_predicates: poly_existential_predicates:
_intern_poly_existential_predicates(ty::Binder<'tcx, ExistentialPredicate<'tcx>>), _intern_poly_existential_predicates(PolyExistentialPredicate<'tcx>),
predicates: _intern_predicates(Predicate<'tcx>), predicates: _intern_predicates(Predicate<'tcx>),
projs: _intern_projs(ProjectionKind), projs: _intern_projs(ProjectionKind),
place_elems: _intern_place_elems(PlaceElem<'tcx>), place_elems: _intern_place_elems(PlaceElem<'tcx>),
@ -2544,7 +2543,7 @@ impl<'tcx> TyCtxt<'tcx> {
#[inline] #[inline]
pub fn mk_dynamic( pub fn mk_dynamic(
self, self,
obj: &'tcx List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>>, obj: &'tcx List<PolyExistentialPredicate<'tcx>>,
reg: ty::Region<'tcx>, reg: ty::Region<'tcx>,
repr: DynKind, repr: DynKind,
) -> Ty<'tcx> { ) -> Ty<'tcx> {
@ -2682,8 +2681,8 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn intern_poly_existential_predicates( pub fn intern_poly_existential_predicates(
self, self,
eps: &[ty::Binder<'tcx, ExistentialPredicate<'tcx>>], eps: &[PolyExistentialPredicate<'tcx>],
) -> &'tcx List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> { ) -> &'tcx List<PolyExistentialPredicate<'tcx>> {
assert!(!eps.is_empty()); assert!(!eps.is_empty());
assert!( assert!(
eps.array_windows() eps.array_windows()
@ -2767,10 +2766,7 @@ impl<'tcx> TyCtxt<'tcx> {
} }
pub fn mk_poly_existential_predicates< pub fn mk_poly_existential_predicates<
I: InternAs< I: InternAs<[PolyExistentialPredicate<'tcx>], &'tcx List<PolyExistentialPredicate<'tcx>>>,
[ty::Binder<'tcx, ExistentialPredicate<'tcx>>],
&'tcx List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>>,
>,
>( >(
self, self,
iter: I, iter: I,

View File

@ -64,9 +64,7 @@ pub enum TypeError<'tcx> {
CyclicTy(Ty<'tcx>), CyclicTy(Ty<'tcx>),
CyclicConst(ty::Const<'tcx>), CyclicConst(ty::Const<'tcx>),
ProjectionMismatched(ExpectedFound<DefId>), ProjectionMismatched(ExpectedFound<DefId>),
ExistentialMismatch( ExistentialMismatch(ExpectedFound<&'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>>),
ExpectedFound<&'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>>,
),
ObjectUnsafeCoercion(DefId), ObjectUnsafeCoercion(DefId),
ConstMismatch(ExpectedFound<ty::Const<'tcx>>), ConstMismatch(ExpectedFound<ty::Const<'tcx>>),

View File

@ -94,9 +94,10 @@ pub use self::sty::{
BoundVariableKind, CanonicalPolyFnSig, ClosureSubsts, ClosureSubstsParts, ConstVid, BoundVariableKind, CanonicalPolyFnSig, ClosureSubsts, ClosureSubstsParts, ConstVid,
EarlyBoundRegion, ExistentialPredicate, ExistentialProjection, ExistentialTraitRef, FnSig, EarlyBoundRegion, ExistentialPredicate, ExistentialProjection, ExistentialTraitRef, FnSig,
FreeRegion, GenSig, GeneratorSubsts, GeneratorSubstsParts, InlineConstSubsts, FreeRegion, GenSig, GeneratorSubsts, GeneratorSubstsParts, InlineConstSubsts,
InlineConstSubstsParts, ParamConst, ParamTy, PolyExistentialProjection, InlineConstSubstsParts, ParamConst, ParamTy, PolyExistentialPredicate,
PolyExistentialTraitRef, PolyFnSig, PolyGenSig, PolyTraitRef, ProjectionTy, Region, RegionKind, PolyExistentialProjection, PolyExistentialTraitRef, PolyFnSig, PolyGenSig, PolyTraitRef,
RegionVid, TraitRef, TyKind, TypeAndMut, UpvarSubsts, VarianceDiagInfo, ProjectionTy, Region, RegionKind, RegionVid, TraitRef, TyKind, TypeAndMut, UpvarSubsts,
VarianceDiagInfo,
}; };
pub use self::trait_def::TraitDef; pub use self::trait_def::TraitDef;

View File

@ -63,7 +63,7 @@ pub trait Printer<'tcx>: Sized {
fn print_dyn_existential( fn print_dyn_existential(
self, self,
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error>; ) -> Result<Self::DynExistential, Self::Error>;
fn print_const(self, ct: ty::Const<'tcx>) -> Result<Self::Const, Self::Error>; fn print_const(self, ct: ty::Const<'tcx>) -> Result<Self::Const, Self::Error>;
@ -308,9 +308,7 @@ impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for Ty<'tcx> {
} }
} }
impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> {
for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>
{
type Output = P::DynExistential; type Output = P::DynExistential;
type Error = P::Error; type Error = P::Error;
fn print(&self, cx: P) -> Result<Self::Output, Self::Error> { fn print(&self, cx: P) -> Result<Self::Output, Self::Error> {

View File

@ -1059,7 +1059,7 @@ pub trait PrettyPrinter<'tcx>:
fn pretty_print_dyn_existential( fn pretty_print_dyn_existential(
mut self, mut self,
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error> { ) -> Result<Self::DynExistential, Self::Error> {
// Generate the main trait ref, including associated types. // Generate the main trait ref, including associated types.
let mut first = true; let mut first = true;
@ -1763,7 +1763,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
fn print_dyn_existential( fn print_dyn_existential(
self, self,
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error> { ) -> Result<Self::DynExistential, Self::Error> {
self.pretty_print_dyn_existential(predicates) self.pretty_print_dyn_existential(predicates)
} }
@ -2523,12 +2523,12 @@ pub struct PrintClosureAsImpl<'tcx> {
forward_display_to_print! { forward_display_to_print! {
ty::Region<'tcx>, ty::Region<'tcx>,
Ty<'tcx>, Ty<'tcx>,
&'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
ty::Const<'tcx>, ty::Const<'tcx>,
// HACK(eddyb) these are exhaustive instead of generic, // HACK(eddyb) these are exhaustive instead of generic,
// because `for<'tcx>` isn't possible yet. // because `for<'tcx>` isn't possible yet.
ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>, ty::PolyExistentialPredicate<'tcx>,
ty::Binder<'tcx, ty::TraitRef<'tcx>>, ty::Binder<'tcx, ty::TraitRef<'tcx>>,
ty::Binder<'tcx, ty::ExistentialTraitRef<'tcx>>, ty::Binder<'tcx, ty::ExistentialTraitRef<'tcx>>,
ty::Binder<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>, ty::Binder<'tcx, TraitRefPrintOnlyTraitPath<'tcx>>,

View File

@ -649,7 +649,7 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
if is_match { Ok(a) } else { Err(TypeError::ConstMismatch(expected_found(relation, a, b))) } if is_match { Ok(a) } else { Err(TypeError::ConstMismatch(expected_found(relation, a, b))) }
} }
impl<'tcx> Relate<'tcx> for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>> { impl<'tcx> Relate<'tcx> for &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> {
fn relate<R: TypeRelation<'tcx>>( fn relate<R: TypeRelation<'tcx>>(
relation: &mut R, relation: &mut R,
a: Self, a: Self,

View File

@ -586,7 +586,7 @@ impl<'tcx, T: TypeVisitable<'tcx>> TypeSuperVisitable<'tcx> for ty::Binder<'tcx,
} }
} }
impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>> { impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> {
fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> { fn try_fold_with<F: FallibleTypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
ty::util::fold_list(self, folder, |tcx, v| tcx.intern_poly_existential_predicates(v)) ty::util::fold_list(self, folder, |tcx, v| tcx.intern_poly_existential_predicates(v))
} }

View File

@ -703,7 +703,9 @@ impl<'tcx> ExistentialPredicate<'tcx> {
} }
} }
impl<'tcx> Binder<'tcx, ExistentialPredicate<'tcx>> { pub type PolyExistentialPredicate<'tcx> = Binder<'tcx, ExistentialPredicate<'tcx>>;
impl<'tcx> PolyExistentialPredicate<'tcx> {
/// Given an existential predicate like `?Self: PartialEq<u32>` (e.g., derived from `dyn PartialEq<u32>`), /// Given an existential predicate like `?Self: PartialEq<u32>` (e.g., derived from `dyn PartialEq<u32>`),
/// and a concrete type `self_ty`, returns a full predicate where the existentially quantified variable `?Self` /// and a concrete type `self_ty`, returns a full predicate where the existentially quantified variable `?Self`
/// has been replaced with `self_ty` (e.g., `self_ty: PartialEq<u32>`, in our example). /// has been replaced with `self_ty` (e.g., `self_ty: PartialEq<u32>`, in our example).
@ -727,7 +729,7 @@ impl<'tcx> Binder<'tcx, ExistentialPredicate<'tcx>> {
} }
} }
impl<'tcx> List<ty::Binder<'tcx, ExistentialPredicate<'tcx>>> { impl<'tcx> List<ty::PolyExistentialPredicate<'tcx>> {
/// Returns the "principal `DefId`" of this set of existential predicates. /// Returns the "principal `DefId`" of this set of existential predicates.
/// ///
/// A Rust trait object type consists (in addition to a lifetime bound) /// A Rust trait object type consists (in addition to a lifetime bound)

View File

@ -244,7 +244,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
fn print_dyn_existential( fn print_dyn_existential(
mut self, mut self,
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error> { ) -> Result<Self::DynExistential, Self::Error> {
let mut first = true; let mut first = true;
for p in predicates { for p in predicates {

View File

@ -12,8 +12,8 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef}; use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
use rustc_middle::ty::{ use rustc_middle::ty::{
self, Binder, Const, ExistentialPredicate, FloatTy, FnSig, IntTy, List, Region, RegionKind, self, Const, ExistentialPredicate, FloatTy, FnSig, IntTy, List, Region, RegionKind, TermKind,
TermKind, Ty, TyCtxt, UintTy, Ty, TyCtxt, UintTy,
}; };
use rustc_span::def_id::DefId; use rustc_span::def_id::DefId;
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
@ -226,7 +226,7 @@ fn encode_fnsig<'tcx>(
/// Rust types that are not used at the FFI boundary. /// Rust types that are not used at the FFI boundary.
fn encode_predicate<'tcx>( fn encode_predicate<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
predicate: Binder<'tcx, ExistentialPredicate<'tcx>>, predicate: ty::PolyExistentialPredicate<'tcx>,
dict: &mut FxHashMap<DictKey<'tcx>, usize>, dict: &mut FxHashMap<DictKey<'tcx>, usize>,
options: EncodeTyOptions, options: EncodeTyOptions,
) -> String { ) -> String {
@ -261,13 +261,13 @@ fn encode_predicate<'tcx>(
/// Rust types that are not used at the FFI boundary. /// Rust types that are not used at the FFI boundary.
fn encode_predicates<'tcx>( fn encode_predicates<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
predicates: &List<Binder<'tcx, ExistentialPredicate<'tcx>>>, predicates: &List<ty::PolyExistentialPredicate<'tcx>>,
dict: &mut FxHashMap<DictKey<'tcx>, usize>, dict: &mut FxHashMap<DictKey<'tcx>, usize>,
options: EncodeTyOptions, options: EncodeTyOptions,
) -> String { ) -> String {
// <predicate1[..predicateN]>E as part of vendor extended type // <predicate1[..predicateN]>E as part of vendor extended type
let mut s = String::new(); let mut s = String::new();
let predicates: Vec<Binder<'tcx, ExistentialPredicate<'tcx>>> = let predicates: Vec<ty::PolyExistentialPredicate<'tcx>> =
predicates.iter().map(|predicate| predicate).collect(); predicates.iter().map(|predicate| predicate).collect();
for predicate in predicates { for predicate in predicates {
s.push_str(&encode_predicate(tcx, predicate, dict, options)); s.push_str(&encode_predicate(tcx, predicate, dict, options));

View File

@ -502,7 +502,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
fn print_dyn_existential( fn print_dyn_existential(
mut self, mut self,
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Result<Self::DynExistential, Self::Error> { ) -> Result<Self::DynExistential, Self::Error> {
// Okay, so this is a bit tricky. Imagine we have a trait object like // Okay, so this is a bit tricky. Imagine we have a trait object like
// `dyn for<'a> Foo<'a, Bar = &'a ()>`. When we mangle this, the // `dyn for<'a> Foo<'a, Bar = &'a ()>`. When we mangle this, the

View File

@ -758,7 +758,7 @@ impl<'tcx> WfPredicates<'tcx> {
fn from_object_ty( fn from_object_ty(
&mut self, &mut self,
ty: Ty<'tcx>, ty: Ty<'tcx>,
data: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, data: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
region: ty::Region<'tcx>, region: ty::Region<'tcx>,
) { ) {
// Imagine a type like this: // Imagine a type like this:
@ -822,7 +822,7 @@ impl<'tcx> WfPredicates<'tcx> {
/// `infer::required_region_bounds`, see that for more information. /// `infer::required_region_bounds`, see that for more information.
pub fn object_region_bounds<'tcx>( pub fn object_region_bounds<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
existential_predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>, existential_predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
) -> Vec<ty::Region<'tcx>> { ) -> Vec<ty::Region<'tcx>> {
// Since we don't actually *know* the self type for an object, // Since we don't actually *know* the self type for an object,
// this "open(err)" serves as a kind of dummy standin -- basically // this "open(err)" serves as a kind of dummy standin -- basically

View File

@ -634,7 +634,7 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_ir::QuantifiedWhereClause<RustInterner<'
} }
impl<'tcx> LowerInto<'tcx, chalk_ir::Binders<chalk_ir::QuantifiedWhereClauses<RustInterner<'tcx>>>> impl<'tcx> LowerInto<'tcx, chalk_ir::Binders<chalk_ir::QuantifiedWhereClauses<RustInterner<'tcx>>>>
for &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>> for &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>
{ {
fn lower_into( fn lower_into(
self, self,

View File

@ -687,7 +687,7 @@ fn check_ptr_arg_usage<'tcx>(cx: &LateContext<'tcx>, body: &'tcx Body<'_>, args:
fn matches_preds<'tcx>( fn matches_preds<'tcx>(
cx: &LateContext<'tcx>, cx: &LateContext<'tcx>,
ty: Ty<'tcx>, ty: Ty<'tcx>,
preds: &'tcx [Binder<'tcx, ExistentialPredicate<'tcx>>], preds: &'tcx [ty::PolyExistentialPredicate<'tcx>],
) -> bool { ) -> bool {
let infcx = cx.tcx.infer_ctxt().build(); let infcx = cx.tcx.infer_ctxt().build();
preds.iter().all(|&p| match cx.tcx.erase_late_bound_regions(p) { preds.iter().all(|&p| match cx.tcx.erase_late_bound_regions(p) {