change skip_binder
to use T by value
This commit is contained in:
parent
1d7ba5fcb4
commit
71b45b97d3
36 changed files with 78 additions and 83 deletions
|
@ -302,7 +302,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||||
// Screen out `'a: 'a` cases -- we skip the binder here but
|
// Screen out `'a: 'a` cases -- we skip the binder here but
|
||||||
// only compare the inner values to one another, so they are still at
|
// only compare the inner values to one another, so they are still at
|
||||||
// consistent binding levels.
|
// consistent binding levels.
|
||||||
let &ty::OutlivesPredicate(k1, r2) = r_c.skip_binder();
|
let ty::OutlivesPredicate(k1, r2) = r_c.skip_binder();
|
||||||
if k1 != r2.into() { Some(r_c) } else { None }
|
if k1 != r2.into() { Some(r_c) } else { None }
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -526,7 +526,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||||
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a + Captures<'tcx> {
|
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a + Captures<'tcx> {
|
||||||
unsubstituted_region_constraints.iter().map(move |constraint| {
|
unsubstituted_region_constraints.iter().map(move |constraint| {
|
||||||
let constraint = substitute_value(self.tcx, result_subst, constraint);
|
let constraint = substitute_value(self.tcx, result_subst, constraint);
|
||||||
let &ty::OutlivesPredicate(k1, r2) = constraint.skip_binder(); // restored below
|
let ty::OutlivesPredicate(k1, r2) = constraint.skip_binder(); // restored below
|
||||||
|
|
||||||
Obligation::new(
|
Obligation::new(
|
||||||
cause.clone(),
|
cause.clone(),
|
||||||
|
|
|
@ -496,7 +496,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
||||||
where
|
where
|
||||||
T: Relate<'tcx>,
|
T: Relate<'tcx>,
|
||||||
{
|
{
|
||||||
Ok(ty::Binder::bind(self.relate(*a.skip_binder(), *b.skip_binder())?))
|
Ok(ty::Binder::bind(self.relate(a.skip_binder(), b.skip_binder())?))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn relate_item_substs(
|
fn relate_item_substs(
|
||||||
|
|
|
@ -135,7 +135,7 @@ impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> {
|
||||||
self.fields.higher_ranked_sub(b, a, self.a_is_expected)
|
self.fields.higher_ranked_sub(b, a, self.a_is_expected)
|
||||||
} else {
|
} else {
|
||||||
// Fast path for the common case.
|
// Fast path for the common case.
|
||||||
self.relate(*a.skip_binder(), *b.skip_binder())?;
|
self.relate(a.skip_binder(), b.skip_binder())?;
|
||||||
Ok(a)
|
Ok(a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,10 +159,9 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: consider taking `ty::Binder` directly, without the reference.
|
|
||||||
fn create_scope(
|
fn create_scope(
|
||||||
&mut self,
|
&mut self,
|
||||||
value: &ty::Binder<impl TypeFoldable<'tcx>>,
|
value: ty::Binder<impl Relate<'tcx>>,
|
||||||
universally_quantified: UniversallyQuantified,
|
universally_quantified: UniversallyQuantified,
|
||||||
) -> BoundRegionScope<'tcx> {
|
) -> BoundRegionScope<'tcx> {
|
||||||
let mut scope = BoundRegionScope::default();
|
let mut scope = BoundRegionScope::default();
|
||||||
|
@ -654,8 +653,8 @@ where
|
||||||
// instantiation of B (i.e., B instantiated with
|
// instantiation of B (i.e., B instantiated with
|
||||||
// universals).
|
// universals).
|
||||||
|
|
||||||
let b_scope = self.create_scope(&b, UniversallyQuantified(true));
|
let b_scope = self.create_scope(b, UniversallyQuantified(true));
|
||||||
let a_scope = self.create_scope(&a, UniversallyQuantified(false));
|
let a_scope = self.create_scope(a, UniversallyQuantified(false));
|
||||||
|
|
||||||
debug!("binders: a_scope = {:?} (existential)", a_scope);
|
debug!("binders: a_scope = {:?} (existential)", a_scope);
|
||||||
debug!("binders: b_scope = {:?} (universal)", b_scope);
|
debug!("binders: b_scope = {:?} (universal)", b_scope);
|
||||||
|
@ -683,7 +682,7 @@ where
|
||||||
// subtyping (i.e., `&'b u32 <: &{P} u32`).
|
// subtyping (i.e., `&'b u32 <: &{P} u32`).
|
||||||
let variance = ::std::mem::replace(&mut self.ambient_variance, ty::Variance::Covariant);
|
let variance = ::std::mem::replace(&mut self.ambient_variance, ty::Variance::Covariant);
|
||||||
|
|
||||||
self.relate(*a.skip_binder(), *b.skip_binder())?;
|
self.relate(a.skip_binder(), b.skip_binder())?;
|
||||||
|
|
||||||
self.ambient_variance = variance;
|
self.ambient_variance = variance;
|
||||||
|
|
||||||
|
@ -698,8 +697,8 @@ where
|
||||||
// instantiation of B (i.e., B instantiated with
|
// instantiation of B (i.e., B instantiated with
|
||||||
// existentials). Opposite of above.
|
// existentials). Opposite of above.
|
||||||
|
|
||||||
let a_scope = self.create_scope(&a, UniversallyQuantified(true));
|
let a_scope = self.create_scope(a, UniversallyQuantified(true));
|
||||||
let b_scope = self.create_scope(&b, UniversallyQuantified(false));
|
let b_scope = self.create_scope(b, UniversallyQuantified(false));
|
||||||
|
|
||||||
debug!("binders: a_scope = {:?} (universal)", a_scope);
|
debug!("binders: a_scope = {:?} (universal)", a_scope);
|
||||||
debug!("binders: b_scope = {:?} (existential)", b_scope);
|
debug!("binders: b_scope = {:?} (existential)", b_scope);
|
||||||
|
@ -712,7 +711,7 @@ where
|
||||||
let variance =
|
let variance =
|
||||||
::std::mem::replace(&mut self.ambient_variance, ty::Variance::Contravariant);
|
::std::mem::replace(&mut self.ambient_variance, ty::Variance::Contravariant);
|
||||||
|
|
||||||
self.relate(*a.skip_binder(), *b.skip_binder())?;
|
self.relate(a.skip_binder(), b.skip_binder())?;
|
||||||
|
|
||||||
self.ambient_variance = variance;
|
self.ambient_variance = variance;
|
||||||
|
|
||||||
|
@ -1010,7 +1009,7 @@ where
|
||||||
debug!("TypeGeneralizer::binders(a={:?})", a);
|
debug!("TypeGeneralizer::binders(a={:?})", a);
|
||||||
|
|
||||||
self.first_free_index.shift_in(1);
|
self.first_free_index.shift_in(1);
|
||||||
let result = self.relate(*a.skip_binder(), *a.skip_binder())?;
|
let result = self.relate(a.skip_binder(), a.skip_binder())?;
|
||||||
self.first_free_index.shift_out(1);
|
self.first_free_index.shift_out(1);
|
||||||
Ok(ty::Binder::bind(result))
|
Ok(ty::Binder::bind(result))
|
||||||
}
|
}
|
||||||
|
|
|
@ -911,7 +911,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
|
||||||
}
|
}
|
||||||
let sig = cx.tables().node_type(expr.hir_id).fn_sig(cx.tcx);
|
let sig = cx.tables().node_type(expr.hir_id).fn_sig(cx.tcx);
|
||||||
let from = sig.inputs().skip_binder()[0];
|
let from = sig.inputs().skip_binder()[0];
|
||||||
let to = *sig.output().skip_binder();
|
let to = sig.output().skip_binder();
|
||||||
return Some((from, to));
|
return Some((from, to));
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
|
|
|
@ -123,7 +123,7 @@ where
|
||||||
T: HashStable<StableHashingContext<'a>>,
|
T: HashStable<StableHashingContext<'a>>,
|
||||||
{
|
{
|
||||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||||
self.skip_binder().hash_stable(hcx, hasher);
|
self.as_ref().skip_binder().hash_stable(hcx, hasher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,6 @@ impl TypeRelation<'tcx> for Match<'tcx> {
|
||||||
where
|
where
|
||||||
T: Relate<'tcx>,
|
T: Relate<'tcx>,
|
||||||
{
|
{
|
||||||
Ok(ty::Binder::bind(self.relate(*a.skip_binder(), *b.skip_binder())?))
|
Ok(ty::Binder::bind(self.relate(a.skip_binder(), b.skip_binder())?))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,13 +88,13 @@ impl FlagComputation {
|
||||||
self.add_substs(substs);
|
self.add_substs(substs);
|
||||||
}
|
}
|
||||||
|
|
||||||
&ty::GeneratorWitness(ref ts) => {
|
&ty::GeneratorWitness(ts) => {
|
||||||
let mut computation = FlagComputation::new();
|
let mut computation = FlagComputation::new();
|
||||||
computation.add_tys(&ts.skip_binder()[..]);
|
computation.add_tys(ts.skip_binder());
|
||||||
self.add_bound_computation(computation);
|
self.add_bound_computation(computation);
|
||||||
}
|
}
|
||||||
|
|
||||||
&ty::Closure(_, ref substs) => {
|
&ty::Closure(_, substs) => {
|
||||||
self.add_substs(substs);
|
self.add_substs(substs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ impl FlagComputation {
|
||||||
self.add_substs(substs);
|
self.add_substs(substs);
|
||||||
}
|
}
|
||||||
|
|
||||||
&ty::Projection(ref data) => {
|
&ty::Projection(data) => {
|
||||||
self.add_flags(TypeFlags::HAS_TY_PROJECTION);
|
self.add_flags(TypeFlags::HAS_TY_PROJECTION);
|
||||||
self.add_projection_ty(data);
|
self.add_projection_ty(data);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ impl FlagComputation {
|
||||||
|
|
||||||
self.add_bound_computation(computation);
|
self.add_bound_computation(computation);
|
||||||
}
|
}
|
||||||
ty::PredicateKind::Projection(projection) => {
|
&ty::PredicateKind::Projection(projection) => {
|
||||||
let mut computation = FlagComputation::new();
|
let mut computation = FlagComputation::new();
|
||||||
let ty::ProjectionPredicate { projection_ty, ty } = projection.skip_binder();
|
let ty::ProjectionPredicate { projection_ty, ty } = projection.skip_binder();
|
||||||
computation.add_projection_ty(projection_ty);
|
computation.add_projection_ty(projection_ty);
|
||||||
|
@ -298,7 +298,7 @@ impl FlagComputation {
|
||||||
self.add_ty(projection.ty);
|
self.add_ty(projection.ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_projection_ty(&mut self, projection_ty: &ty::ProjectionTy<'_>) {
|
fn add_projection_ty(&mut self, projection_ty: ty::ProjectionTy<'_>) {
|
||||||
self.add_substs(projection_ty.substs);
|
self.add_substs(projection_ty.substs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
{
|
{
|
||||||
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &Binder<T>) -> bool {
|
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &Binder<T>) -> bool {
|
||||||
self.outer_index.shift_in(1);
|
self.outer_index.shift_in(1);
|
||||||
let result = t.skip_binder().visit_with(self);
|
let result = t.as_ref().skip_binder().visit_with(self);
|
||||||
self.outer_index.shift_out(1);
|
self.outer_index.shift_out(1);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
@ -558,7 +558,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
let fld_c = |bound_ct, ty| {
|
let fld_c = |bound_ct, ty| {
|
||||||
self.mk_const(ty::Const { val: ty::ConstKind::Bound(ty::INNERMOST, bound_ct), ty })
|
self.mk_const(ty::Const { val: ty::ConstKind::Bound(ty::INNERMOST, bound_ct), ty })
|
||||||
};
|
};
|
||||||
self.replace_escaping_bound_vars(value.skip_binder(), fld_r, fld_t, fld_c)
|
self.replace_escaping_bound_vars(value.as_ref().skip_binder(), fld_r, fld_t, fld_c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Replaces all escaping bound vars. The `fld_r` closure replaces escaping
|
/// Replaces all escaping bound vars. The `fld_r` closure replaces escaping
|
||||||
|
@ -617,7 +617,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
H: FnMut(ty::BoundVar, Ty<'tcx>) -> &'tcx ty::Const<'tcx>,
|
H: FnMut(ty::BoundVar, Ty<'tcx>) -> &'tcx ty::Const<'tcx>,
|
||||||
T: TypeFoldable<'tcx>,
|
T: TypeFoldable<'tcx>,
|
||||||
{
|
{
|
||||||
self.replace_escaping_bound_vars(value.skip_binder(), fld_r, fld_t, fld_c)
|
self.replace_escaping_bound_vars(value.as_ref().skip_binder(), fld_r, fld_t, fld_c)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Replaces any late-bound regions bound in `value` with
|
/// Replaces any late-bound regions bound in `value` with
|
||||||
|
@ -673,7 +673,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
T: TypeFoldable<'tcx>,
|
T: TypeFoldable<'tcx>,
|
||||||
{
|
{
|
||||||
let mut collector = LateBoundRegionsCollector::new(just_constraint);
|
let mut collector = LateBoundRegionsCollector::new(just_constraint);
|
||||||
let result = value.skip_binder().visit_with(&mut collector);
|
let result = value.as_ref().skip_binder().visit_with(&mut collector);
|
||||||
assert!(!result); // should never have stopped early
|
assert!(!result); // should never have stopped early
|
||||||
collector.regions
|
collector.regions
|
||||||
}
|
}
|
||||||
|
|
|
@ -2303,7 +2303,7 @@ impl<'tcx> ty::Instance<'tcx> {
|
||||||
|
|
||||||
let env_ty = tcx.closure_env_ty(def_id, substs).unwrap();
|
let env_ty = tcx.closure_env_ty(def_id, substs).unwrap();
|
||||||
sig.map_bound(|sig| tcx.mk_fn_sig(
|
sig.map_bound(|sig| tcx.mk_fn_sig(
|
||||||
iter::once(*env_ty.skip_binder()).chain(sig.inputs().iter().cloned()),
|
iter::once(env_ty.skip_binder()).chain(sig.inputs().iter().cloned()),
|
||||||
sig.output(),
|
sig.output(),
|
||||||
sig.c_variadic,
|
sig.c_variadic,
|
||||||
sig.unsafety,
|
sig.unsafety,
|
||||||
|
|
|
@ -189,7 +189,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||||
where
|
where
|
||||||
T: Print<'tcx, Self, Output = Self, Error = Self::Error> + TypeFoldable<'tcx>,
|
T: Print<'tcx, Self, Output = Self, Error = Self::Error> + TypeFoldable<'tcx>,
|
||||||
{
|
{
|
||||||
value.skip_binder().print(self)
|
value.as_ref().skip_binder().print(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prints comma-separated elements.
|
/// Prints comma-separated elements.
|
||||||
|
|
|
@ -514,7 +514,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::PredicateKind<'a> {
|
||||||
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder<T> {
|
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder<T> {
|
||||||
type Lifted = ty::Binder<T::Lifted>;
|
type Lifted = ty::Binder<T::Lifted>;
|
||||||
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
|
||||||
tcx.lift(self.skip_binder()).map(ty::Binder::bind)
|
tcx.lift(self.as_ref().skip_binder()).map(ty::Binder::bind)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -798,7 +798,7 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for ty::Binder<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||||
self.skip_binder().visit_with(visitor)
|
self.as_ref().skip_binder().visit_with(visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
|
||||||
|
|
|
@ -615,7 +615,7 @@ impl<'tcx> ExistentialPredicate<'tcx> {
|
||||||
impl<'tcx> Binder<ExistentialPredicate<'tcx>> {
|
impl<'tcx> Binder<ExistentialPredicate<'tcx>> {
|
||||||
pub fn with_self_ty(&self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> {
|
pub fn with_self_ty(&self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> {
|
||||||
use crate::ty::ToPredicate;
|
use crate::ty::ToPredicate;
|
||||||
match *self.skip_binder() {
|
match self.skip_binder() {
|
||||||
ExistentialPredicate::Trait(tr) => {
|
ExistentialPredicate::Trait(tr) => {
|
||||||
Binder(tr).with_self_ty(tcx, self_ty).without_const().to_predicate(tcx)
|
Binder(tr).with_self_ty(tcx, self_ty).without_const().to_predicate(tcx)
|
||||||
}
|
}
|
||||||
|
@ -776,7 +776,7 @@ impl<'tcx> PolyTraitRef<'tcx> {
|
||||||
|
|
||||||
pub fn to_poly_trait_predicate(&self) -> ty::PolyTraitPredicate<'tcx> {
|
pub fn to_poly_trait_predicate(&self) -> ty::PolyTraitPredicate<'tcx> {
|
||||||
// Note that we preserve binding levels
|
// Note that we preserve binding levels
|
||||||
Binder(ty::TraitPredicate { trait_ref: *self.skip_binder() })
|
Binder(ty::TraitPredicate { trait_ref: self.skip_binder() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,8 +880,8 @@ impl<T> Binder<T> {
|
||||||
/// - extracting the `DefId` from a PolyTraitRef;
|
/// - extracting the `DefId` from a PolyTraitRef;
|
||||||
/// - comparing the self type of a PolyTraitRef to see if it is equal to
|
/// - comparing the self type of a PolyTraitRef to see if it is equal to
|
||||||
/// a type parameter `X`, since the type `X` does not reference any regions
|
/// a type parameter `X`, since the type `X` does not reference any regions
|
||||||
pub fn skip_binder(&self) -> &T {
|
pub fn skip_binder(self) -> T {
|
||||||
&self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_ref(&self) -> Binder<&T> {
|
pub fn as_ref(&self) -> Binder<&T> {
|
||||||
|
@ -916,11 +916,7 @@ impl<T> Binder<T> {
|
||||||
where
|
where
|
||||||
T: TypeFoldable<'tcx>,
|
T: TypeFoldable<'tcx>,
|
||||||
{
|
{
|
||||||
if self.skip_binder().has_escaping_bound_vars() {
|
if self.0.has_escaping_bound_vars() { None } else { Some(self.skip_binder()) }
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(self.skip_binder().clone())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given two things that have the same binder level,
|
/// Given two things that have the same binder level,
|
||||||
|
@ -997,7 +993,7 @@ impl<'tcx> ProjectionTy<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, TypeFoldable)]
|
#[derive(Copy, Clone, Debug, TypeFoldable)]
|
||||||
pub struct GenSig<'tcx> {
|
pub struct GenSig<'tcx> {
|
||||||
pub resume_ty: Ty<'tcx>,
|
pub resume_ty: Ty<'tcx>,
|
||||||
pub yield_ty: Ty<'tcx>,
|
pub yield_ty: Ty<'tcx>,
|
||||||
|
|
|
@ -133,7 +133,7 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>)
|
||||||
ty::Dynamic(obj, lt) => {
|
ty::Dynamic(obj, lt) => {
|
||||||
stack.push(lt.into());
|
stack.push(lt.into());
|
||||||
stack.extend(obj.iter().rev().flat_map(|predicate| {
|
stack.extend(obj.iter().rev().flat_map(|predicate| {
|
||||||
let (substs, opt_ty) = match *predicate.skip_binder() {
|
let (substs, opt_ty) = match predicate.skip_binder() {
|
||||||
ty::ExistentialPredicate::Trait(tr) => (tr.substs, None),
|
ty::ExistentialPredicate::Trait(tr) => (tr.substs, None),
|
||||||
ty::ExistentialPredicate::Projection(p) => (p.substs, Some(p.ty)),
|
ty::ExistentialPredicate::Projection(p) => (p.substs, Some(p.ty)),
|
||||||
ty::ExistentialPredicate::AutoTrait(_) =>
|
ty::ExistentialPredicate::AutoTrait(_) =>
|
||||||
|
|
|
@ -1923,7 +1923,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
|
|
||||||
// We use a mix of the HIR and the Ty types to get information
|
// We use a mix of the HIR and the Ty types to get information
|
||||||
// as the HIR doesn't have full types for closure arguments.
|
// as the HIR doesn't have full types for closure arguments.
|
||||||
let return_ty = *sig.output().skip_binder();
|
let return_ty = sig.output().skip_binder();
|
||||||
let mut return_span = fn_decl.output.span();
|
let mut return_span = fn_decl.output.span();
|
||||||
if let hir::FnRetTy::Return(ty) = &fn_decl.output {
|
if let hir::FnRetTy::Return(ty) = &fn_decl.output {
|
||||||
if let hir::TyKind::Rptr(lifetime, _) = ty.kind {
|
if let hir::TyKind::Rptr(lifetime, _) = ty.kind {
|
||||||
|
@ -1965,7 +1965,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
let argument_ty = sig.inputs().skip_binder().first()?;
|
let argument_ty = sig.inputs().skip_binder().first()?;
|
||||||
|
|
||||||
let return_span = fn_decl.output.span();
|
let return_span = fn_decl.output.span();
|
||||||
let return_ty = *sig.output().skip_binder();
|
let return_ty = sig.output().skip_binder();
|
||||||
|
|
||||||
// We expect the first argument to be a reference.
|
// We expect the first argument to be a reference.
|
||||||
match argument_ty.kind {
|
match argument_ty.kind {
|
||||||
|
|
|
@ -422,7 +422,7 @@ impl Visitor<'tcx> for ExprVisitor<'tcx> {
|
||||||
let typ = self.tables.node_type(expr.hir_id);
|
let typ = self.tables.node_type(expr.hir_id);
|
||||||
let sig = typ.fn_sig(self.tcx);
|
let sig = typ.fn_sig(self.tcx);
|
||||||
let from = sig.inputs().skip_binder()[0];
|
let from = sig.inputs().skip_binder()[0];
|
||||||
let to = *sig.output().skip_binder();
|
let to = sig.output().skip_binder();
|
||||||
self.check_transmute(expr.span, from, to);
|
self.check_transmute(expr.span, from, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,14 +92,14 @@ where
|
||||||
for (predicate, _span) in predicates {
|
for (predicate, _span) in predicates {
|
||||||
match predicate.kind() {
|
match predicate.kind() {
|
||||||
ty::PredicateKind::Trait(poly_predicate, _) => {
|
ty::PredicateKind::Trait(poly_predicate, _) => {
|
||||||
let ty::TraitPredicate { trait_ref } = *poly_predicate.skip_binder();
|
let ty::TraitPredicate { trait_ref } = poly_predicate.skip_binder();
|
||||||
if self.visit_trait(trait_ref) {
|
if self.visit_trait(trait_ref) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::PredicateKind::Projection(poly_predicate) => {
|
ty::PredicateKind::Projection(poly_predicate) => {
|
||||||
let ty::ProjectionPredicate { projection_ty, ty } =
|
let ty::ProjectionPredicate { projection_ty, ty } =
|
||||||
*poly_predicate.skip_binder();
|
poly_predicate.skip_binder();
|
||||||
if ty.visit_with(self) {
|
if ty.visit_with(self) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::PredicateKind::TypeOutlives(poly_predicate) => {
|
ty::PredicateKind::TypeOutlives(poly_predicate) => {
|
||||||
let ty::OutlivesPredicate(ty, _region) = *poly_predicate.skip_binder();
|
let ty::OutlivesPredicate(ty, _region) = poly_predicate.skip_binder();
|
||||||
if ty.visit_with(self) {
|
if ty.visit_with(self) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ where
|
||||||
ty::Dynamic(predicates, ..) => {
|
ty::Dynamic(predicates, ..) => {
|
||||||
// All traits in the list are considered the "primary" part of the type
|
// All traits in the list are considered the "primary" part of the type
|
||||||
// and are visited by shallow visitors.
|
// and are visited by shallow visitors.
|
||||||
for predicate in *predicates.skip_binder() {
|
for predicate in predicates.skip_binder() {
|
||||||
let trait_ref = match predicate {
|
let trait_ref = match predicate {
|
||||||
ty::ExistentialPredicate::Trait(trait_ref) => trait_ref,
|
ty::ExistentialPredicate::Trait(trait_ref) => trait_ref,
|
||||||
ty::ExistentialPredicate::Projection(proj) => proj.trait_ref(tcx),
|
ty::ExistentialPredicate::Projection(proj) => proj.trait_ref(tcx),
|
||||||
|
@ -1270,7 +1270,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
||||||
);
|
);
|
||||||
|
|
||||||
for (trait_predicate, _, _) in bounds.trait_bounds {
|
for (trait_predicate, _, _) in bounds.trait_bounds {
|
||||||
if self.visit_trait(*trait_predicate.skip_binder()) {
|
if self.visit_trait(trait_predicate.skip_binder()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ impl SymbolMangler<'tcx> {
|
||||||
lifetime_depths.end += lifetimes;
|
lifetime_depths.end += lifetimes;
|
||||||
|
|
||||||
self.binders.push(BinderLevel { lifetime_depths });
|
self.binders.push(BinderLevel { lifetime_depths });
|
||||||
self = print_value(self, value.skip_binder())?;
|
self = print_value(self, value.as_ref().skip_binder())?;
|
||||||
self.binders.pop();
|
self.binders.pop();
|
||||||
|
|
||||||
Ok(self)
|
Ok(self)
|
||||||
|
|
|
@ -691,7 +691,7 @@ where
|
||||||
OP: FnMut(ty::Region<'tcx>),
|
OP: FnMut(ty::Region<'tcx>),
|
||||||
{
|
{
|
||||||
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> bool {
|
fn visit_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> bool {
|
||||||
t.skip_binder().visit_with(self);
|
t.as_ref().skip_binder().visit_with(self);
|
||||||
false // keep visiting
|
false // keep visiting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1569,7 +1569,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
// no need to overload user in such cases
|
// no need to overload user in such cases
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let &SubtypePredicate { a_is_expected: _, a, b } = data.skip_binder();
|
let SubtypePredicate { a_is_expected: _, a, b } = data.skip_binder();
|
||||||
// both must be type variables, or the other would've been instantiated
|
// both must be type variables, or the other would've been instantiated
|
||||||
assert!(a.is_ty_var() && b.is_ty_var());
|
assert!(a.is_ty_var() && b.is_ty_var());
|
||||||
self.need_type_info_err(body_id, span, a, ErrorCode::E0282)
|
self.need_type_info_err(body_id, span, a, ErrorCode::E0282)
|
||||||
|
|
|
@ -122,7 +122,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
) -> OnUnimplementedNote {
|
) -> OnUnimplementedNote {
|
||||||
let def_id =
|
let def_id =
|
||||||
self.impl_similar_to(trait_ref, obligation).unwrap_or_else(|| trait_ref.def_id());
|
self.impl_similar_to(trait_ref, obligation).unwrap_or_else(|| trait_ref.def_id());
|
||||||
let trait_ref = *trait_ref.skip_binder();
|
let trait_ref = trait_ref.skip_binder();
|
||||||
|
|
||||||
let mut flags = vec![];
|
let mut flags = vec![];
|
||||||
flags.push((
|
flags.push((
|
||||||
|
@ -219,7 +219,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let ty::Dynamic(traits, _) = self_ty.kind {
|
if let ty::Dynamic(traits, _) = self_ty.kind {
|
||||||
for t in *traits.skip_binder() {
|
for t in traits.skip_binder() {
|
||||||
if let ty::ExistentialPredicate::Trait(trait_ref) = t {
|
if let ty::ExistentialPredicate::Trait(trait_ref) = t {
|
||||||
flags.push((sym::_Self, Some(self.tcx.def_path_str(trait_ref.def_id))))
|
flags.push((sym::_Self, Some(self.tcx.def_path_str(trait_ref.def_id))))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
) -> DiagnosticBuilder<'tcx> {
|
) -> DiagnosticBuilder<'tcx> {
|
||||||
crate fn build_fn_sig_string<'tcx>(
|
crate fn build_fn_sig_string<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
trait_ref: &ty::TraitRef<'tcx>,
|
trait_ref: ty::TraitRef<'tcx>,
|
||||||
) -> String {
|
) -> String {
|
||||||
let inputs = trait_ref.substs.type_at(1);
|
let inputs = trait_ref.substs.type_at(1);
|
||||||
let sig = if let ty::Tuple(inputs) = inputs.kind {
|
let sig = if let ty::Tuple(inputs) = inputs.kind {
|
||||||
|
@ -1360,7 +1360,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
ty::GeneratorWitness(..) => {}
|
ty::GeneratorWitness(..) => {}
|
||||||
_ if generator.is_none() => {
|
_ if generator.is_none() => {
|
||||||
trait_ref = Some(*derived_obligation.parent_trait_ref.skip_binder());
|
trait_ref = Some(derived_obligation.parent_trait_ref.skip_binder());
|
||||||
target_ty = Some(ty);
|
target_ty = Some(ty);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
@ -220,7 +220,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
// Okay to skip binder because the substs on generator types never
|
// Okay to skip binder because the substs on generator types never
|
||||||
// touch bound regions, they just capture the in-scope
|
// touch bound regions, they just capture the in-scope
|
||||||
// type/region parameters.
|
// type/region parameters.
|
||||||
let self_ty = *obligation.self_ty().skip_binder();
|
let self_ty = obligation.self_ty().skip_binder();
|
||||||
match self_ty.kind {
|
match self_ty.kind {
|
||||||
ty::Generator(..) => {
|
ty::Generator(..) => {
|
||||||
debug!(
|
debug!(
|
||||||
|
@ -299,7 +299,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Okay to skip binder because what we are inspecting doesn't involve bound regions.
|
// Okay to skip binder because what we are inspecting doesn't involve bound regions.
|
||||||
let self_ty = *obligation.self_ty().skip_binder();
|
let self_ty = obligation.self_ty().skip_binder();
|
||||||
match self_ty.kind {
|
match self_ty.kind {
|
||||||
ty::Infer(ty::TyVar(_)) => {
|
ty::Infer(ty::TyVar(_)) => {
|
||||||
debug!("assemble_fn_pointer_candidates: ambiguous self-type");
|
debug!("assemble_fn_pointer_candidates: ambiguous self-type");
|
||||||
|
@ -362,7 +362,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) -> Result<(), SelectionError<'tcx>> {
|
) -> Result<(), SelectionError<'tcx>> {
|
||||||
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
||||||
let self_ty = *obligation.self_ty().skip_binder();
|
let self_ty = obligation.self_ty().skip_binder();
|
||||||
debug!("assemble_candidates_from_auto_impls(self_ty={:?})", self_ty);
|
debug!("assemble_candidates_from_auto_impls(self_ty={:?})", self_ty);
|
||||||
|
|
||||||
let def_id = obligation.predicate.def_id();
|
let def_id = obligation.predicate.def_id();
|
||||||
|
@ -583,7 +583,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||||
) -> Result<(), SelectionError<'tcx>> {
|
) -> Result<(), SelectionError<'tcx>> {
|
||||||
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
// Okay to skip binder here because the tests we do below do not involve bound regions.
|
||||||
let self_ty = *obligation.self_ty().skip_binder();
|
let self_ty = obligation.self_ty().skip_binder();
|
||||||
debug!("assemble_candidates_for_trait_alias(self_ty={:?})", self_ty);
|
debug!("assemble_candidates_for_trait_alias(self_ty={:?})", self_ty);
|
||||||
|
|
||||||
let def_id = obligation.predicate.def_id();
|
let def_id = obligation.predicate.def_id();
|
||||||
|
|
|
@ -326,7 +326,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
// probably flatten the binder from the obligation and the binder
|
// probably flatten the binder from the obligation and the binder
|
||||||
// from the object. Have to try to make a broken test case that
|
// from the object. Have to try to make a broken test case that
|
||||||
// results.
|
// results.
|
||||||
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
|
let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
|
||||||
let poly_trait_ref = match self_ty.kind {
|
let poly_trait_ref = match self_ty.kind {
|
||||||
ty::Dynamic(ref data, ..) => data
|
ty::Dynamic(ref data, ..) => data
|
||||||
.principal()
|
.principal()
|
||||||
|
@ -379,7 +379,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
debug!("confirm_fn_pointer_candidate({:?})", obligation);
|
debug!("confirm_fn_pointer_candidate({:?})", obligation);
|
||||||
|
|
||||||
// Okay to skip binder; it is reintroduced below.
|
// Okay to skip binder; it is reintroduced below.
|
||||||
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
|
let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
|
||||||
let sig = self_ty.fn_sig(self.tcx());
|
let sig = self_ty.fn_sig(self.tcx());
|
||||||
let trait_ref = closure_trait_ref_and_return_type(
|
let trait_ref = closure_trait_ref_and_return_type(
|
||||||
self.tcx(),
|
self.tcx(),
|
||||||
|
@ -448,7 +448,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
// Okay to skip binder because the substs on generator types never
|
// Okay to skip binder because the substs on generator types never
|
||||||
// touch bound regions, they just capture the in-scope
|
// touch bound regions, they just capture the in-scope
|
||||||
// type/region parameters.
|
// type/region parameters.
|
||||||
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
|
let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
|
||||||
let (generator_def_id, substs) = match self_ty.kind {
|
let (generator_def_id, substs) = match self_ty.kind {
|
||||||
ty::Generator(id, substs, _) => (id, substs),
|
ty::Generator(id, substs, _) => (id, substs),
|
||||||
_ => bug!("closure candidate for non-closure {:?}", obligation),
|
_ => bug!("closure candidate for non-closure {:?}", obligation),
|
||||||
|
@ -497,7 +497,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
// Okay to skip binder because the substs on closure types never
|
// Okay to skip binder because the substs on closure types never
|
||||||
// touch bound regions, they just capture the in-scope
|
// touch bound regions, they just capture the in-scope
|
||||||
// type/region parameters.
|
// type/region parameters.
|
||||||
let self_ty = self.infcx.shallow_resolve(*obligation.self_ty().skip_binder());
|
let self_ty = self.infcx.shallow_resolve(obligation.self_ty().skip_binder());
|
||||||
let (closure_def_id, substs) = match self_ty.kind {
|
let (closure_def_id, substs) = match self_ty.kind {
|
||||||
ty::Closure(id, substs) => (id, substs),
|
ty::Closure(id, substs) => (id, substs),
|
||||||
_ => bug!("closure candidate for non-closure {:?}", obligation),
|
_ => bug!("closure candidate for non-closure {:?}", obligation),
|
||||||
|
|
|
@ -695,7 +695,7 @@ pub fn object_region_bounds<'tcx>(
|
||||||
let open_ty = tcx.mk_ty_infer(ty::FreshTy(0));
|
let open_ty = tcx.mk_ty_infer(ty::FreshTy(0));
|
||||||
|
|
||||||
let predicates = existential_predicates.iter().filter_map(|predicate| {
|
let predicates = existential_predicates.iter().filter_map(|predicate| {
|
||||||
if let ty::ExistentialPredicate::Projection(_) = *predicate.skip_binder() {
|
if let ty::ExistentialPredicate::Projection(_) = predicate.skip_binder() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(predicate.with_self_ty(tcx, open_ty))
|
Some(predicate.with_self_ty(tcx, open_ty))
|
||||||
|
|
|
@ -615,7 +615,7 @@ crate fn collect_bound_vars<'a, 'tcx, T: TypeFoldable<'tcx>>(
|
||||||
ty: &'a Binder<T>,
|
ty: &'a Binder<T>,
|
||||||
) -> (T, chalk_ir::VariableKinds<RustInterner<'tcx>>, BTreeMap<DefId, u32>) {
|
) -> (T, chalk_ir::VariableKinds<RustInterner<'tcx>>, BTreeMap<DefId, u32>) {
|
||||||
let mut bound_vars_collector = BoundVarsCollector::new();
|
let mut bound_vars_collector = BoundVarsCollector::new();
|
||||||
ty.skip_binder().visit_with(&mut bound_vars_collector);
|
ty.as_ref().skip_binder().visit_with(&mut bound_vars_collector);
|
||||||
let mut parameters = bound_vars_collector.parameters;
|
let mut parameters = bound_vars_collector.parameters;
|
||||||
let named_parameters: BTreeMap<DefId, u32> = bound_vars_collector
|
let named_parameters: BTreeMap<DefId, u32> = bound_vars_collector
|
||||||
.named_parameters
|
.named_parameters
|
||||||
|
@ -625,7 +625,7 @@ crate fn collect_bound_vars<'a, 'tcx, T: TypeFoldable<'tcx>>(
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut bound_var_substitutor = NamedBoundVarSubstitutor::new(tcx, &named_parameters);
|
let mut bound_var_substitutor = NamedBoundVarSubstitutor::new(tcx, &named_parameters);
|
||||||
let new_ty = ty.skip_binder().fold_with(&mut bound_var_substitutor);
|
let new_ty = ty.as_ref().skip_binder().fold_with(&mut bound_var_substitutor);
|
||||||
|
|
||||||
for var in named_parameters.values() {
|
for var in named_parameters.values() {
|
||||||
parameters.insert(*var, chalk_ir::VariableKind::Lifetime);
|
parameters.insert(*var, chalk_ir::VariableKind::Lifetime);
|
||||||
|
|
|
@ -1802,7 +1802,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
|
|
||||||
// Calling `skip_binder` is okay because the predicates are re-bound.
|
// Calling `skip_binder` is okay because the predicates are re-bound.
|
||||||
let regular_trait_predicates = existential_trait_refs
|
let regular_trait_predicates = existential_trait_refs
|
||||||
.map(|trait_ref| ty::ExistentialPredicate::Trait(*trait_ref.skip_binder()));
|
.map(|trait_ref| ty::ExistentialPredicate::Trait(trait_ref.skip_binder()));
|
||||||
let auto_trait_predicates = auto_traits
|
let auto_trait_predicates = auto_traits
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|trait_ref| ty::ExistentialPredicate::AutoTrait(trait_ref.trait_ref().def_id()));
|
.map(|trait_ref| ty::ExistentialPredicate::AutoTrait(trait_ref.trait_ref().def_id()));
|
||||||
|
@ -1810,7 +1810,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
.chain(auto_trait_predicates)
|
.chain(auto_trait_predicates)
|
||||||
.chain(
|
.chain(
|
||||||
existential_projections
|
existential_projections
|
||||||
.map(|x| ty::ExistentialPredicate::Projection(*x.skip_binder())),
|
.map(|x| ty::ExistentialPredicate::Projection(x.skip_binder())),
|
||||||
)
|
)
|
||||||
.collect::<SmallVec<[_; 8]>>();
|
.collect::<SmallVec<[_; 8]>>();
|
||||||
v.sort_by(|a, b| a.stable_cmp(tcx, b));
|
v.sort_by(|a, b| a.stable_cmp(tcx, b));
|
||||||
|
|
|
@ -188,7 +188,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
ty::Infer(ty::TyVar(vid)) => self.deduce_expectations_from_obligations(vid),
|
ty::Infer(ty::TyVar(vid)) => self.deduce_expectations_from_obligations(vid),
|
||||||
ty::FnPtr(sig) => {
|
ty::FnPtr(sig) => {
|
||||||
let expected_sig = ExpectedSig { cause_span: None, sig: *sig.skip_binder() };
|
let expected_sig = ExpectedSig { cause_span: None, sig: sig.skip_binder() };
|
||||||
(Some(expected_sig), Some(ty::ClosureKind::Fn))
|
(Some(expected_sig), Some(ty::ClosureKind::Fn))
|
||||||
}
|
}
|
||||||
_ => (None, None),
|
_ => (None, None),
|
||||||
|
@ -501,7 +501,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
for ((hir_ty, &supplied_ty), expected_ty) in decl
|
for ((hir_ty, &supplied_ty), expected_ty) in decl
|
||||||
.inputs
|
.inputs
|
||||||
.iter()
|
.iter()
|
||||||
.zip(*supplied_sig.inputs().skip_binder()) // binder moved to (*) below
|
.zip(supplied_sig.inputs().skip_binder()) // binder moved to (*) below
|
||||||
.zip(expected_sigs.liberated_sig.inputs())
|
.zip(expected_sigs.liberated_sig.inputs())
|
||||||
// `liberated_sig` is E'.
|
// `liberated_sig` is E'.
|
||||||
{
|
{
|
||||||
|
|
|
@ -502,7 +502,7 @@ fn compare_self_type<'tcx>(
|
||||||
ty::ImplContainer(_) => impl_trait_ref.self_ty(),
|
ty::ImplContainer(_) => impl_trait_ref.self_ty(),
|
||||||
ty::TraitContainer(_) => tcx.types.self_param,
|
ty::TraitContainer(_) => tcx.types.self_param,
|
||||||
};
|
};
|
||||||
let self_arg_ty = *tcx.fn_sig(method.def_id).input(0).skip_binder();
|
let self_arg_ty = tcx.fn_sig(method.def_id).input(0).skip_binder();
|
||||||
let param_env = ty::ParamEnv::reveal_all();
|
let param_env = ty::ParamEnv::reveal_all();
|
||||||
|
|
||||||
tcx.infer_ctxt().enter(|infcx| {
|
tcx.infer_ctxt().enter(|infcx| {
|
||||||
|
|
|
@ -366,7 +366,7 @@ impl TypeRelation<'tcx> for SimpleEqRelation<'tcx> {
|
||||||
// After we do so, it should be totally fine to skip the binders.
|
// After we do so, it should be totally fine to skip the binders.
|
||||||
let anon_a = self.tcx.anonymize_late_bound_regions(&a);
|
let anon_a = self.tcx.anonymize_late_bound_regions(&a);
|
||||||
let anon_b = self.tcx.anonymize_late_bound_regions(&b);
|
let anon_b = self.tcx.anonymize_late_bound_regions(&b);
|
||||||
self.relate(*anon_a.skip_binder(), *anon_b.skip_binder())?;
|
self.relate(anon_a.skip_binder(), anon_b.skip_binder())?;
|
||||||
|
|
||||||
Ok(a.clone())
|
Ok(a.clone())
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,7 +608,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
ty::Adt(def, _) => bound_spans.push((def_span(def.did), msg)),
|
ty::Adt(def, _) => bound_spans.push((def_span(def.did), msg)),
|
||||||
// Point at the trait object that couldn't satisfy the bound.
|
// Point at the trait object that couldn't satisfy the bound.
|
||||||
ty::Dynamic(preds, _) => {
|
ty::Dynamic(preds, _) => {
|
||||||
for pred in *preds.skip_binder() {
|
for pred in preds.skip_binder() {
|
||||||
match pred {
|
match pred {
|
||||||
ty::ExistentialPredicate::Trait(tr) => {
|
ty::ExistentialPredicate::Trait(tr) => {
|
||||||
bound_spans.push((def_span(tr.def_id), msg.clone()))
|
bound_spans.push((def_span(tr.def_id), msg.clone()))
|
||||||
|
|
|
@ -2446,7 +2446,7 @@ fn bounds_from_generic_predicates(
|
||||||
/// Return placeholder code for the given function.
|
/// Return placeholder code for the given function.
|
||||||
fn fn_sig_suggestion(
|
fn fn_sig_suggestion(
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
sig: &ty::FnSig<'_>,
|
sig: ty::FnSig<'_>,
|
||||||
ident: Ident,
|
ident: Ident,
|
||||||
predicates: ty::GenericPredicates<'_>,
|
predicates: ty::GenericPredicates<'_>,
|
||||||
assoc: &ty::AssocItem,
|
assoc: &ty::AssocItem,
|
||||||
|
|
|
@ -500,7 +500,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// We're emitting a suggestion, so we can just ignore regions
|
// We're emitting a suggestion, so we can just ignore regions
|
||||||
let fn_sig = *self.tcx.fn_sig(def_id).skip_binder();
|
let fn_sig = self.tcx.fn_sig(def_id).skip_binder();
|
||||||
|
|
||||||
let other_ty = if let FnDef(def_id, _) = other_ty.kind {
|
let other_ty = if let FnDef(def_id, _) = other_ty.kind {
|
||||||
if !self.tcx.has_typeck_tables(def_id) {
|
if !self.tcx.has_typeck_tables(def_id) {
|
||||||
|
|
|
@ -216,7 +216,7 @@ fn check_object_overlap<'tcx>(
|
||||||
let component_def_ids = data.iter().flat_map(|predicate| {
|
let component_def_ids = data.iter().flat_map(|predicate| {
|
||||||
match predicate.skip_binder() {
|
match predicate.skip_binder() {
|
||||||
ty::ExistentialPredicate::Trait(tr) => Some(tr.def_id),
|
ty::ExistentialPredicate::Trait(tr) => Some(tr.def_id),
|
||||||
ty::ExistentialPredicate::AutoTrait(def_id) => Some(*def_id),
|
ty::ExistentialPredicate::AutoTrait(def_id) => Some(def_id),
|
||||||
// An associated type projection necessarily comes with
|
// An associated type projection necessarily comes with
|
||||||
// an additional `Trait` requirement.
|
// an additional `Trait` requirement.
|
||||||
ty::ExistentialPredicate::Projection(..) => None,
|
ty::ExistentialPredicate::Projection(..) => None,
|
||||||
|
|
|
@ -2102,11 +2102,11 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||||
.emit();
|
.emit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (input, ty) in decl.inputs.iter().zip(*fty.inputs().skip_binder()) {
|
for (input, ty) in decl.inputs.iter().zip(fty.inputs().skip_binder()) {
|
||||||
check(&input, ty)
|
check(&input, ty)
|
||||||
}
|
}
|
||||||
if let hir::FnRetTy::Return(ref ty) = decl.output {
|
if let hir::FnRetTy::Return(ref ty) = decl.output {
|
||||||
check(&ty, *fty.output().skip_binder())
|
check(&ty, fty.output().skip_binder())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -347,7 +347,7 @@ impl Clean<GenericBound> for (ty::PolyTraitRef<'_>, &[TypeBinding]) {
|
||||||
|
|
||||||
GenericBound::TraitBound(
|
GenericBound::TraitBound(
|
||||||
PolyTrait {
|
PolyTrait {
|
||||||
trait_: (*poly_trait_ref.skip_binder(), bounds).clean(cx),
|
trait_: (poly_trait_ref.skip_binder(), bounds).clean(cx),
|
||||||
generic_params: late_bound_regions,
|
generic_params: late_bound_regions,
|
||||||
},
|
},
|
||||||
hir::TraitBoundModifier::None,
|
hir::TraitBoundModifier::None,
|
||||||
|
@ -549,7 +549,7 @@ impl<'tcx> Clean<Option<WherePredicate>> for ty::PolyOutlivesPredicate<Ty<'tcx>,
|
||||||
|
|
||||||
impl<'tcx> Clean<WherePredicate> for ty::PolyProjectionPredicate<'tcx> {
|
impl<'tcx> Clean<WherePredicate> for ty::PolyProjectionPredicate<'tcx> {
|
||||||
fn clean(&self, cx: &DocContext<'_>) -> WherePredicate {
|
fn clean(&self, cx: &DocContext<'_>) -> WherePredicate {
|
||||||
let ty::ProjectionPredicate { projection_ty, ty } = *self.skip_binder();
|
let ty::ProjectionPredicate { projection_ty, ty } = self.skip_binder();
|
||||||
WherePredicate::EqPredicate { lhs: projection_ty.clean(cx), rhs: ty.clean(cx) }
|
WherePredicate::EqPredicate { lhs: projection_ty.clean(cx), rhs: ty.clean(cx) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1177,7 @@ impl Clean<Item> for ty::AssocItem {
|
||||||
ty::ImplContainer(def_id) => cx.tcx.type_of(def_id),
|
ty::ImplContainer(def_id) => cx.tcx.type_of(def_id),
|
||||||
ty::TraitContainer(_) => cx.tcx.types.self_param,
|
ty::TraitContainer(_) => cx.tcx.types.self_param,
|
||||||
};
|
};
|
||||||
let self_arg_ty = *sig.input(0).skip_binder();
|
let self_arg_ty = sig.input(0).skip_binder();
|
||||||
if self_arg_ty == self_ty {
|
if self_arg_ty == self_ty {
|
||||||
decl.inputs.values[0].type_ = Generic(String::from("Self"));
|
decl.inputs.values[0].type_ = Generic(String::from("Self"));
|
||||||
} else if let ty::Ref(_, ty, _) = self_arg_ty.kind {
|
} else if let ty::Ref(_, ty, _) = self_arg_ty.kind {
|
||||||
|
@ -1679,7 +1679,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||||
if let ty::PredicateKind::Projection(proj) = pred.kind() {
|
if let ty::PredicateKind::Projection(proj) = pred.kind() {
|
||||||
let proj = proj.skip_binder();
|
let proj = proj.skip_binder();
|
||||||
if proj.projection_ty.trait_ref(cx.tcx)
|
if proj.projection_ty.trait_ref(cx.tcx)
|
||||||
== *trait_ref.skip_binder()
|
== trait_ref.skip_binder()
|
||||||
{
|
{
|
||||||
Some(TypeBinding {
|
Some(TypeBinding {
|
||||||
name: cx
|
name: cx
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue