Add alias for ArgOutlivesPredicate
This commit is contained in:
parent
78fa79e7a6
commit
3634f46fdb
14 changed files with 26 additions and 36 deletions
|
|
@ -126,9 +126,9 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
|||
|
||||
fn convert(
|
||||
&mut self,
|
||||
predicate: ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
|
||||
predicate: ty::ArgOutlivesPredicate<'tcx>,
|
||||
constraint_category: ConstraintCategory<'tcx>,
|
||||
higher_ranked_assumptions: &FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
higher_ranked_assumptions: &FxHashSet<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
) {
|
||||
let tcx = self.infcx.tcx;
|
||||
debug!("generate: constraints at: {:#?}", self.locations);
|
||||
|
|
@ -282,7 +282,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
|||
&self,
|
||||
ty: Ty<'tcx>,
|
||||
next_outlives_predicates: &mut Vec<(
|
||||
ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
|
||||
ty::ArgOutlivesPredicate<'tcx>,
|
||||
ConstraintCategory<'tcx>,
|
||||
)>,
|
||||
) -> Ty<'tcx> {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ use smallvec::smallvec;
|
|||
|
||||
/// Tracks the `T: 'a` or `'a: 'a` predicates that we have inferred
|
||||
/// must be added to the struct header.
|
||||
pub(crate) type RequiredPredicates<'tcx> =
|
||||
FxIndexMap<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>, Span>;
|
||||
pub(crate) type RequiredPredicates<'tcx> = FxIndexMap<ty::ArgOutlivesPredicate<'tcx>, Span>;
|
||||
|
||||
/// Given a requirement `T: 'a` or `'b: 'a`, deduce the
|
||||
/// outlives_component and add it to `required_predicates`
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ pub fn make_query_region_constraints<'tcx>(
|
|||
tcx: TyCtxt<'tcx>,
|
||||
outlives_obligations: Vec<TypeOutlivesConstraint<'tcx>>,
|
||||
region_constraints: &RegionConstraintData<'tcx>,
|
||||
assumptions: Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
) -> QueryRegionConstraints<'tcx> {
|
||||
let RegionConstraintData { constraints, verifys } = region_constraints;
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ pub struct InferCtxtInner<'tcx> {
|
|||
/// are deduced from the well-formedness of the witness's types, and are
|
||||
/// necessary because of the way we anonymize the regions in a coroutine,
|
||||
/// which may cause types to no longer be considered well-formed.
|
||||
region_assumptions: Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
region_assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
|
||||
/// Caches for opaque type inference.
|
||||
opaque_type_storage: OpaqueTypeStorage<'tcx>,
|
||||
|
|
@ -183,7 +183,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn region_assumptions(&self) -> &[ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>] {
|
||||
pub fn region_assumptions(&self) -> &[ty::ArgOutlivesPredicate<'tcx>] {
|
||||
&self.region_assumptions
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ pub struct OutlivesEnvironment<'tcx> {
|
|||
known_type_outlives: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
|
||||
/// Assumptions that come from the well-formedness of coroutines that we prove
|
||||
/// auto trait bounds for during the type checking of this body.
|
||||
higher_ranked_assumptions: FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
higher_ranked_assumptions: FxHashSet<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
}
|
||||
|
||||
/// "Region-bound pairs" tracks outlives relations that are known to
|
||||
|
|
@ -55,7 +55,7 @@ impl<'tcx> OutlivesEnvironment<'tcx> {
|
|||
param_env: ty::ParamEnv<'tcx>,
|
||||
known_type_outlives: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
|
||||
extra_bounds: impl IntoIterator<Item = OutlivesBound<'tcx>>,
|
||||
higher_ranked_assumptions: FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
higher_ranked_assumptions: FxHashSet<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
) -> Self {
|
||||
let mut region_relation = TransitiveRelationBuilder::default();
|
||||
let mut region_bound_pairs = RegionBoundPairs::default();
|
||||
|
|
@ -108,9 +108,7 @@ impl<'tcx> OutlivesEnvironment<'tcx> {
|
|||
&self.known_type_outlives
|
||||
}
|
||||
|
||||
pub fn higher_ranked_assumptions(
|
||||
&self,
|
||||
) -> &FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> {
|
||||
pub fn higher_ranked_assumptions(&self) -> &FxHashSet<ty::ArgOutlivesPredicate<'tcx>> {
|
||||
&self.higher_ranked_assumptions
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ use crate::traits::{ObligationCause, ObligationCauseCode};
|
|||
impl<'tcx> InferCtxt<'tcx> {
|
||||
pub fn register_outlives_constraint(
|
||||
&self,
|
||||
ty::OutlivesPredicate(arg, r2): ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
|
||||
ty::OutlivesPredicate(arg, r2): ty::ArgOutlivesPredicate<'tcx>,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
) {
|
||||
match arg.kind() {
|
||||
|
|
@ -170,18 +170,13 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
std::mem::take(&mut self.inner.borrow_mut().region_obligations)
|
||||
}
|
||||
|
||||
pub fn register_region_assumption(
|
||||
&self,
|
||||
assumption: ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
|
||||
) {
|
||||
pub fn register_region_assumption(&self, assumption: ty::ArgOutlivesPredicate<'tcx>) {
|
||||
let mut inner = self.inner.borrow_mut();
|
||||
inner.undo_log.push(UndoLog::PushRegionAssumption);
|
||||
inner.region_assumptions.push(assumption);
|
||||
}
|
||||
|
||||
pub fn take_registered_region_assumptions(
|
||||
&self,
|
||||
) -> Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> {
|
||||
pub fn take_registered_region_assumptions(&self) -> Vec<ty::ArgOutlivesPredicate<'tcx>> {
|
||||
std::mem::take(&mut self.inner.borrow_mut().region_assumptions)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ pub struct QueryResponse<'tcx, R> {
|
|||
#[derive(HashStable, TypeFoldable, TypeVisitable)]
|
||||
pub struct QueryRegionConstraints<'tcx> {
|
||||
pub outlives: Vec<QueryOutlivesConstraint<'tcx>>,
|
||||
pub assumptions: Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
pub assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
}
|
||||
|
||||
impl QueryRegionConstraints<'_> {
|
||||
|
|
@ -135,8 +135,7 @@ impl<'tcx, R> QueryResponse<'tcx, R> {
|
|||
}
|
||||
}
|
||||
|
||||
pub type QueryOutlivesConstraint<'tcx> =
|
||||
(ty::OutlivesPredicate<'tcx, GenericArg<'tcx>>, ConstraintCategory<'tcx>);
|
||||
pub type QueryOutlivesConstraint<'tcx> = (ty::ArgOutlivesPredicate<'tcx>, ConstraintCategory<'tcx>);
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct CanonicalParamEnvCache<'tcx> {
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
|
|||
type BoundRegion = ty::BoundRegion;
|
||||
type PlaceholderRegion = ty::PlaceholderRegion;
|
||||
|
||||
type RegionAssumptions = &'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>;
|
||||
type RegionAssumptions = &'tcx ty::List<ty::ArgOutlivesPredicate<'tcx>>;
|
||||
|
||||
type ParamEnv = ty::ParamEnv<'tcx>;
|
||||
type Predicate = Predicate<'tcx>;
|
||||
|
|
@ -876,7 +876,7 @@ pub struct CtxtInterners<'tcx> {
|
|||
offset_of: InternedSet<'tcx, List<(VariantIdx, FieldIdx)>>,
|
||||
valtree: InternedSet<'tcx, ty::ValTreeKind<'tcx>>,
|
||||
patterns: InternedSet<'tcx, List<ty::Pattern<'tcx>>>,
|
||||
outlives: InternedSet<'tcx, List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>>,
|
||||
outlives: InternedSet<'tcx, List<ty::ArgOutlivesPredicate<'tcx>>>,
|
||||
}
|
||||
|
||||
impl<'tcx> CtxtInterners<'tcx> {
|
||||
|
|
@ -2696,7 +2696,7 @@ slice_interners!(
|
|||
captures: intern_captures(&'tcx ty::CapturedPlace<'tcx>),
|
||||
offset_of: pub mk_offset_of((VariantIdx, FieldIdx)),
|
||||
patterns: pub mk_patterns(Pattern<'tcx>),
|
||||
outlives: pub mk_outlives(ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>),
|
||||
outlives: pub mk_outlives(ty::ArgOutlivesPredicate<'tcx>),
|
||||
);
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
|
|
@ -3116,8 +3116,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
where
|
||||
I: Iterator<Item = T>,
|
||||
T: CollectAndApply<
|
||||
ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
|
||||
&'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
ty::ArgOutlivesPredicate<'tcx>,
|
||||
&'tcx ty::List<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
>,
|
||||
{
|
||||
T::collect_and_apply(iter, |xs| self.mk_outlives(xs))
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ pub use self::opaque_types::OpaqueTypeKey;
|
|||
pub use self::parameterized::ParameterizedOverTcx;
|
||||
pub use self::pattern::{Pattern, PatternKind};
|
||||
pub use self::predicate::{
|
||||
AliasTerm, Clause, ClauseKind, CoercePredicate, ExistentialPredicate,
|
||||
AliasTerm, ArgOutlivesPredicate, Clause, ClauseKind, CoercePredicate, ExistentialPredicate,
|
||||
ExistentialPredicateStableCmpExt, ExistentialProjection, ExistentialTraitRef,
|
||||
HostEffectPredicate, NormalizesTo, OutlivesPredicate, PolyCoercePredicate,
|
||||
PolyExistentialPredicate, PolyExistentialProjection, PolyExistentialTraitRef,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ pub type SubtypePredicate<'tcx> = ir::SubtypePredicate<TyCtxt<'tcx>>;
|
|||
pub type OutlivesPredicate<'tcx, T> = ir::OutlivesPredicate<TyCtxt<'tcx>, T>;
|
||||
pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate<'tcx, ty::Region<'tcx>>;
|
||||
pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<'tcx, Ty<'tcx>>;
|
||||
pub type ArgOutlivesPredicate<'tcx> = OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>;
|
||||
pub type PolyTraitPredicate<'tcx> = ty::Binder<'tcx, TraitPredicate<'tcx>>;
|
||||
pub type PolyRegionOutlivesPredicate<'tcx> = ty::Binder<'tcx, RegionOutlivesPredicate<'tcx>>;
|
||||
pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder<'tcx, TypeOutlivesPredicate<'tcx>>;
|
||||
|
|
|
|||
|
|
@ -802,5 +802,5 @@ list_fold! {
|
|||
&'tcx ty::List<ty::PolyExistentialPredicate<'tcx>> : mk_poly_existential_predicates,
|
||||
&'tcx ty::List<PlaceElem<'tcx>> : mk_place_elems,
|
||||
&'tcx ty::List<ty::Pattern<'tcx>> : mk_patterns,
|
||||
&'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> : mk_outlives,
|
||||
&'tcx ty::List<ty::ArgOutlivesPredicate<'tcx>> : mk_outlives,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,9 +206,7 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
|
|||
.map(|obligations| obligations.into_iter().map(|obligation| obligation.as_goal()).collect())
|
||||
}
|
||||
|
||||
fn make_deduplicated_outlives_constraints(
|
||||
&self,
|
||||
) -> Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> {
|
||||
fn make_deduplicated_outlives_constraints(&self) -> Vec<ty::ArgOutlivesPredicate<'tcx>> {
|
||||
// Cannot use `take_registered_region_obligations` as we may compute the response
|
||||
// inside of a `probe` whenever we have multiple choices inside of the solver.
|
||||
let region_obligations = self.0.inner.borrow().region_obligations().to_owned();
|
||||
|
|
|
|||
|
|
@ -3148,5 +3148,5 @@ pub(crate) enum ProjectionMatchesProjection {
|
|||
#[derive(Clone, Debug, TypeFoldable, TypeVisitable)]
|
||||
pub(crate) struct AutoImplConstituents<'tcx> {
|
||||
pub types: Vec<Ty<'tcx>>,
|
||||
pub assumptions: Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
|
||||
pub assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ fn compute_assumptions<'tcx>(
|
|||
tcx: TyCtxt<'tcx>,
|
||||
def_id: DefId,
|
||||
bound_tys: &'tcx ty::List<Ty<'tcx>>,
|
||||
) -> &'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> {
|
||||
) -> &'tcx ty::List<ty::ArgOutlivesPredicate<'tcx>> {
|
||||
let infcx = tcx.infer_ctxt().build(ty::TypingMode::Analysis {
|
||||
defining_opaque_types_and_generators: ty::List::empty(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue