Skip to content

Commit 3634f46

Browse files
Add alias for ArgOutlivesPredicate
1 parent 78fa79e commit 3634f46

File tree

14 files changed

+26
-36
lines changed

14 files changed

+26
-36
lines changed

compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
126126

127127
fn convert(
128128
&mut self,
129-
predicate: ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
129+
predicate: ty::ArgOutlivesPredicate<'tcx>,
130130
constraint_category: ConstraintCategory<'tcx>,
131-
higher_ranked_assumptions: &FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
131+
higher_ranked_assumptions: &FxHashSet<ty::ArgOutlivesPredicate<'tcx>>,
132132
) {
133133
let tcx = self.infcx.tcx;
134134
debug!("generate: constraints at: {:#?}", self.locations);
@@ -282,7 +282,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
282282
&self,
283283
ty: Ty<'tcx>,
284284
next_outlives_predicates: &mut Vec<(
285-
ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
285+
ty::ArgOutlivesPredicate<'tcx>,
286286
ConstraintCategory<'tcx>,
287287
)>,
288288
) -> Ty<'tcx> {

compiler/rustc_hir_analysis/src/outlives/utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use smallvec::smallvec;
77

88
/// Tracks the `T: 'a` or `'a: 'a` predicates that we have inferred
99
/// must be added to the struct header.
10-
pub(crate) type RequiredPredicates<'tcx> =
11-
FxIndexMap<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>, Span>;
10+
pub(crate) type RequiredPredicates<'tcx> = FxIndexMap<ty::ArgOutlivesPredicate<'tcx>, Span>;
1211

1312
/// Given a requirement `T: 'a` or `'b: 'a`, deduce the
1413
/// outlives_component and add it to `required_predicates`

compiler/rustc_infer/src/infer/canonical/query_response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ pub fn make_query_region_constraints<'tcx>(
590590
tcx: TyCtxt<'tcx>,
591591
outlives_obligations: Vec<TypeOutlivesConstraint<'tcx>>,
592592
region_constraints: &RegionConstraintData<'tcx>,
593-
assumptions: Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
593+
assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
594594
) -> QueryRegionConstraints<'tcx> {
595595
let RegionConstraintData { constraints, verifys } = region_constraints;
596596

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub struct InferCtxtInner<'tcx> {
154154
/// are deduced from the well-formedness of the witness's types, and are
155155
/// necessary because of the way we anonymize the regions in a coroutine,
156156
/// which may cause types to no longer be considered well-formed.
157-
region_assumptions: Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
157+
region_assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
158158

159159
/// Caches for opaque type inference.
160160
opaque_type_storage: OpaqueTypeStorage<'tcx>,
@@ -183,7 +183,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
183183
}
184184

185185
#[inline]
186-
pub fn region_assumptions(&self) -> &[ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>] {
186+
pub fn region_assumptions(&self) -> &[ty::ArgOutlivesPredicate<'tcx>] {
187187
&self.region_assumptions
188188
}
189189

compiler/rustc_infer/src/infer/outlives/env.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub struct OutlivesEnvironment<'tcx> {
4141
known_type_outlives: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
4242
/// Assumptions that come from the well-formedness of coroutines that we prove
4343
/// auto trait bounds for during the type checking of this body.
44-
higher_ranked_assumptions: FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
44+
higher_ranked_assumptions: FxHashSet<ty::ArgOutlivesPredicate<'tcx>>,
4545
}
4646

4747
/// "Region-bound pairs" tracks outlives relations that are known to
@@ -55,7 +55,7 @@ impl<'tcx> OutlivesEnvironment<'tcx> {
5555
param_env: ty::ParamEnv<'tcx>,
5656
known_type_outlives: Vec<ty::PolyTypeOutlivesPredicate<'tcx>>,
5757
extra_bounds: impl IntoIterator<Item = OutlivesBound<'tcx>>,
58-
higher_ranked_assumptions: FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
58+
higher_ranked_assumptions: FxHashSet<ty::ArgOutlivesPredicate<'tcx>>,
5959
) -> Self {
6060
let mut region_relation = TransitiveRelationBuilder::default();
6161
let mut region_bound_pairs = RegionBoundPairs::default();
@@ -108,9 +108,7 @@ impl<'tcx> OutlivesEnvironment<'tcx> {
108108
&self.known_type_outlives
109109
}
110110

111-
pub fn higher_ranked_assumptions(
112-
&self,
113-
) -> &FxHashSet<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> {
111+
pub fn higher_ranked_assumptions(&self) -> &FxHashSet<ty::ArgOutlivesPredicate<'tcx>> {
114112
&self.higher_ranked_assumptions
115113
}
116114
}

compiler/rustc_infer/src/infer/outlives/obligations.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ use crate::traits::{ObligationCause, ObligationCauseCode};
8484
impl<'tcx> InferCtxt<'tcx> {
8585
pub fn register_outlives_constraint(
8686
&self,
87-
ty::OutlivesPredicate(arg, r2): ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
87+
ty::OutlivesPredicate(arg, r2): ty::ArgOutlivesPredicate<'tcx>,
8888
cause: &ObligationCause<'tcx>,
8989
) {
9090
match arg.kind() {
@@ -170,18 +170,13 @@ impl<'tcx> InferCtxt<'tcx> {
170170
std::mem::take(&mut self.inner.borrow_mut().region_obligations)
171171
}
172172

173-
pub fn register_region_assumption(
174-
&self,
175-
assumption: ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
176-
) {
173+
pub fn register_region_assumption(&self, assumption: ty::ArgOutlivesPredicate<'tcx>) {
177174
let mut inner = self.inner.borrow_mut();
178175
inner.undo_log.push(UndoLog::PushRegionAssumption);
179176
inner.region_assumptions.push(assumption);
180177
}
181178

182-
pub fn take_registered_region_assumptions(
183-
&self,
184-
) -> Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>> {
179+
pub fn take_registered_region_assumptions(&self) -> Vec<ty::ArgOutlivesPredicate<'tcx>> {
185180
std::mem::take(&mut self.inner.borrow_mut().region_assumptions)
186181
}
187182

compiler/rustc_middle/src/infer/canonical.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub struct QueryResponse<'tcx, R> {
8181
#[derive(HashStable, TypeFoldable, TypeVisitable)]
8282
pub struct QueryRegionConstraints<'tcx> {
8383
pub outlives: Vec<QueryOutlivesConstraint<'tcx>>,
84-
pub assumptions: Vec<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
84+
pub assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
8585
}
8686

8787
impl QueryRegionConstraints<'_> {
@@ -135,8 +135,7 @@ impl<'tcx, R> QueryResponse<'tcx, R> {
135135
}
136136
}
137137

138-
pub type QueryOutlivesConstraint<'tcx> =
139-
(ty::OutlivesPredicate<'tcx, GenericArg<'tcx>>, ConstraintCategory<'tcx>);
138+
pub type QueryOutlivesConstraint<'tcx> = (ty::ArgOutlivesPredicate<'tcx>, ConstraintCategory<'tcx>);
140139

141140
#[derive(Default)]
142141
pub struct CanonicalParamEnvCache<'tcx> {

compiler/rustc_middle/src/ty/context.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
162162
type BoundRegion = ty::BoundRegion;
163163
type PlaceholderRegion = ty::PlaceholderRegion;
164164

165-
type RegionAssumptions = &'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>;
165+
type RegionAssumptions = &'tcx ty::List<ty::ArgOutlivesPredicate<'tcx>>;
166166

167167
type ParamEnv = ty::ParamEnv<'tcx>;
168168
type Predicate = Predicate<'tcx>;
@@ -876,7 +876,7 @@ pub struct CtxtInterners<'tcx> {
876876
offset_of: InternedSet<'tcx, List<(VariantIdx, FieldIdx)>>,
877877
valtree: InternedSet<'tcx, ty::ValTreeKind<'tcx>>,
878878
patterns: InternedSet<'tcx, List<ty::Pattern<'tcx>>>,
879-
outlives: InternedSet<'tcx, List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>>,
879+
outlives: InternedSet<'tcx, List<ty::ArgOutlivesPredicate<'tcx>>>,
880880
}
881881

882882
impl<'tcx> CtxtInterners<'tcx> {
@@ -2696,7 +2696,7 @@ slice_interners!(
26962696
captures: intern_captures(&'tcx ty::CapturedPlace<'tcx>),
26972697
offset_of: pub mk_offset_of((VariantIdx, FieldIdx)),
26982698
patterns: pub mk_patterns(Pattern<'tcx>),
2699-
outlives: pub mk_outlives(ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>),
2699+
outlives: pub mk_outlives(ty::ArgOutlivesPredicate<'tcx>),
27002700
);
27012701

27022702
impl<'tcx> TyCtxt<'tcx> {
@@ -3116,8 +3116,8 @@ impl<'tcx> TyCtxt<'tcx> {
31163116
where
31173117
I: Iterator<Item = T>,
31183118
T: CollectAndApply<
3119-
ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
3120-
&'tcx ty::List<ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>>,
3119+
ty::ArgOutlivesPredicate<'tcx>,
3120+
&'tcx ty::List<ty::ArgOutlivesPredicate<'tcx>>,
31213121
>,
31223122
{
31233123
T::collect_and_apply(iter, |xs| self.mk_outlives(xs))

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub use self::opaque_types::OpaqueTypeKey;
8888
pub use self::parameterized::ParameterizedOverTcx;
8989
pub use self::pattern::{Pattern, PatternKind};
9090
pub use self::predicate::{
91-
AliasTerm, Clause, ClauseKind, CoercePredicate, ExistentialPredicate,
91+
AliasTerm, ArgOutlivesPredicate, Clause, ClauseKind, CoercePredicate, ExistentialPredicate,
9292
ExistentialPredicateStableCmpExt, ExistentialProjection, ExistentialTraitRef,
9393
HostEffectPredicate, NormalizesTo, OutlivesPredicate, PolyCoercePredicate,
9494
PolyExistentialPredicate, PolyExistentialProjection, PolyExistentialTraitRef,

compiler/rustc_middle/src/ty/predicate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub type SubtypePredicate<'tcx> = ir::SubtypePredicate<TyCtxt<'tcx>>;
2626
pub type OutlivesPredicate<'tcx, T> = ir::OutlivesPredicate<TyCtxt<'tcx>, T>;
2727
pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate<'tcx, ty::Region<'tcx>>;
2828
pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<'tcx, Ty<'tcx>>;
29+
pub type ArgOutlivesPredicate<'tcx> = OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>;
2930
pub type PolyTraitPredicate<'tcx> = ty::Binder<'tcx, TraitPredicate<'tcx>>;
3031
pub type PolyRegionOutlivesPredicate<'tcx> = ty::Binder<'tcx, RegionOutlivesPredicate<'tcx>>;
3132
pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder<'tcx, TypeOutlivesPredicate<'tcx>>;

0 commit comments

Comments
 (0)