Skip to content

Commit 0f044ba

Browse files
Rename
1 parent 3efd885 commit 0f044ba

File tree

11 files changed

+37
-28
lines changed

11 files changed

+37
-28
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ fn ty_known_to_outlive<'tcx>(
742742
region: ty::Region<'tcx>,
743743
) -> bool {
744744
test_region_obligations(tcx, id, param_env, wf_tys, |infcx| {
745-
infcx.type_outlives_predicate(infer::RegionObligation {
745+
infcx.register_type_outlives_constraint_inner(infer::TypeOutlivesConstraint {
746746
sub_region: region,
747747
sup_type: ty,
748748
origin: infer::RelateParamBound(DUMMY_SP, ty, None),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'tcx> InferCtxt<'tcx> {
171171

172172
for (predicate, _category) in &query_response.value.region_constraints.outlives {
173173
let predicate = instantiate_value(self.tcx, &result_args, *predicate);
174-
self.outlives_predicate_with_cause(predicate, cause);
174+
self.register_outlives_constraint(predicate, cause);
175175
}
176176

177177
let user_result: R =

compiler/rustc_infer/src/infer/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'tcx> rustc_type_ir::InferCtxtLike for InferCtxt<'tcx> {
214214
}
215215

216216
fn register_ty_outlives(&self, ty: Ty<'tcx>, r: ty::Region<'tcx>, span: Span) {
217-
self.type_outlives_predicate_with_cause(ty, r, &ObligationCause::dummy_with_span(span));
217+
self.register_type_outlives_constraint(ty, r, &ObligationCause::dummy_with_span(span));
218218
}
219219

220220
type OpaqueTypeStorageEntries = OpaqueTypeStorageEntries;

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub struct InferCtxtInner<'tcx> {
150150
/// for each body-id in this map, which will process the
151151
/// obligations within. This is expected to be done 'late enough'
152152
/// that all type inference variables have been bound and so forth.
153-
region_obligations: Vec<RegionObligation<'tcx>>,
153+
region_obligations: Vec<TypeOutlivesConstraint<'tcx>>,
154154

155155
/// Caches for opaque type inference.
156156
opaque_type_storage: OpaqueTypeStorage<'tcx>,
@@ -173,7 +173,7 @@ impl<'tcx> InferCtxtInner<'tcx> {
173173
}
174174

175175
#[inline]
176-
pub fn region_obligations(&self) -> &[RegionObligation<'tcx>] {
176+
pub fn region_obligations(&self) -> &[TypeOutlivesConstraint<'tcx>] {
177177
&self.region_obligations
178178
}
179179

@@ -488,7 +488,7 @@ impl fmt::Display for FixupError {
488488

489489
/// See the `region_obligations` field for more information.
490490
#[derive(Clone, Debug)]
491-
pub struct RegionObligation<'tcx> {
491+
pub struct TypeOutlivesConstraint<'tcx> {
492492
pub sub_region: ty::Region<'tcx>,
493493
pub sup_type: Ty<'tcx>,
494494
pub origin: SubregionOrigin<'tcx>,

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,29 @@ use crate::infer::outlives::env::RegionBoundPairs;
7676
use crate::infer::outlives::verify::VerifyBoundCx;
7777
use crate::infer::resolve::OpportunisticRegionResolver;
7878
use crate::infer::snapshot::undo_log::UndoLog;
79-
use crate::infer::{self, GenericKind, InferCtxt, RegionObligation, SubregionOrigin, VerifyBound};
79+
use crate::infer::{
80+
self, GenericKind, InferCtxt, SubregionOrigin, TypeOutlivesConstraint, VerifyBound,
81+
};
8082
use crate::traits::{ObligationCause, ObligationCauseCode};
8183

8284
impl<'tcx> InferCtxt<'tcx> {
83-
pub fn outlives_predicate_with_cause(
85+
pub fn register_outlives_constraint(
8486
&self,
8587
ty::OutlivesPredicate(arg, r2): ty::OutlivesPredicate<'tcx, ty::GenericArg<'tcx>>,
8688
cause: &ObligationCause<'tcx>,
8789
) {
8890
match arg.unpack() {
8991
ty::GenericArgKind::Lifetime(r1) => {
90-
self.region_outlives_predicate(ty::OutlivesPredicate(r1, r2), cause);
92+
self.register_region_outlives_constraint(ty::OutlivesPredicate(r1, r2), cause);
9193
}
9294
ty::GenericArgKind::Type(ty1) => {
93-
self.type_outlives_predicate_with_cause(ty1, r2, cause);
95+
self.register_type_outlives_constraint(ty1, r2, cause);
9496
}
9597
ty::GenericArgKind::Const(_) => unreachable!(),
9698
}
9799
}
98100

99-
pub fn region_outlives_predicate(
101+
pub fn register_region_outlives_constraint(
100102
&self,
101103
ty::OutlivesPredicate(r_a, r_b): ty::RegionOutlivesPredicate<'tcx>,
102104
cause: &ObligationCause<'tcx>,
@@ -114,13 +116,16 @@ impl<'tcx> InferCtxt<'tcx> {
114116
/// available (see `region_obligations` field for more
115117
/// information).
116118
#[instrument(level = "debug", skip(self))]
117-
pub fn type_outlives_predicate(&self, obligation: RegionObligation<'tcx>) {
119+
pub fn register_type_outlives_constraint_inner(
120+
&self,
121+
obligation: TypeOutlivesConstraint<'tcx>,
122+
) {
118123
let mut inner = self.inner.borrow_mut();
119-
inner.undo_log.push(UndoLog::PushRegionObligation);
124+
inner.undo_log.push(UndoLog::PushTypeOutlivesConstraint);
120125
inner.region_obligations.push(obligation);
121126
}
122127

123-
pub fn type_outlives_predicate_with_cause(
128+
pub fn register_type_outlives_constraint(
124129
&self,
125130
sup_type: Ty<'tcx>,
126131
sub_region: Region<'tcx>,
@@ -152,11 +157,15 @@ impl<'tcx> InferCtxt<'tcx> {
152157
)
153158
});
154159

155-
self.type_outlives_predicate(RegionObligation { sup_type, sub_region, origin });
160+
self.register_type_outlives_constraint_inner(TypeOutlivesConstraint {
161+
sup_type,
162+
sub_region,
163+
origin,
164+
});
156165
}
157166

158167
/// Trait queries just want to pass back type obligations "as is"
159-
pub fn take_registered_region_obligations(&self) -> Vec<RegionObligation<'tcx>> {
168+
pub fn take_registered_region_obligations(&self) -> Vec<TypeOutlivesConstraint<'tcx>> {
160169
std::mem::take(&mut self.inner.borrow_mut().region_obligations)
161170
}
162171

@@ -194,7 +203,7 @@ impl<'tcx> InferCtxt<'tcx> {
194203
);
195204
}
196205

197-
for RegionObligation { sup_type, sub_region, origin } in my_region_obligations {
206+
for TypeOutlivesConstraint { sup_type, sub_region, origin } in my_region_obligations {
198207
let outlives = ty::Binder::dummy(ty::OutlivesPredicate(sup_type, sub_region));
199208
let ty::OutlivesPredicate(sup_type, sub_region) =
200209
deeply_normalize_ty(outlives, origin.clone())

compiler/rustc_infer/src/infer/snapshot/undo_log.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) enum UndoLog<'tcx> {
2626
RegionConstraintCollector(region_constraints::UndoLog<'tcx>),
2727
RegionUnificationTable(sv::UndoLog<ut::Delegate<RegionVidKey<'tcx>>>),
2828
ProjectionCache(traits::UndoLog<'tcx>),
29-
PushRegionObligation,
29+
PushTypeOutlivesConstraint,
3030
}
3131

3232
macro_rules! impl_from {
@@ -72,7 +72,7 @@ impl<'tcx> Rollback<UndoLog<'tcx>> for InferCtxtInner<'tcx> {
7272
self.region_constraint_storage.as_mut().unwrap().unification_table.reverse(undo)
7373
}
7474
UndoLog::ProjectionCache(undo) => self.projection_cache.reverse(undo),
75-
UndoLog::PushRegionObligation => {
75+
UndoLog::PushTypeOutlivesConstraint => {
7676
self.region_obligations.pop();
7777
}
7878
}

compiler/rustc_trait_selection/src/solve/delegate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
7676
Some(HasChanged::No)
7777
}
7878
ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(outlives)) => {
79-
self.0.type_outlives_predicate_with_cause(
79+
self.0.register_type_outlives_constraint(
8080
outlives.0,
8181
outlives.1,
8282
&ObligationCause::dummy_with_span(span),

compiler/rustc_trait_selection/src/traits/auto_trait.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
727727
ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(binder)) => {
728728
let binder = bound_predicate.rebind(binder);
729729
selcx.infcx.enter_forall(binder, |pred| {
730-
selcx.infcx.region_outlives_predicate(pred, &dummy_cause);
730+
selcx.infcx.register_region_outlives_constraint(pred, &dummy_cause);
731731
});
732732
}
733733
ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(binder)) => {
@@ -737,14 +737,14 @@ impl<'tcx> AutoTraitFinder<'tcx> {
737737
binder.map_bound_ref(|pred| pred.0).no_bound_vars(),
738738
) {
739739
(None, Some(t_a)) => {
740-
selcx.infcx.type_outlives_predicate_with_cause(
740+
selcx.infcx.register_type_outlives_constraint(
741741
t_a,
742742
selcx.infcx.tcx.lifetimes.re_static,
743743
&dummy_cause,
744744
);
745745
}
746746
(Some(ty::OutlivesPredicate(t_a, r_b)), _) => {
747-
selcx.infcx.type_outlives_predicate_with_cause(
747+
selcx.infcx.register_type_outlives_constraint(
748748
t_a,
749749
r_b,
750750
&dummy_cause,

compiler/rustc_trait_selection/src/traits/fulfill.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
428428

429429
ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(data)) => {
430430
if infcx.considering_regions {
431-
infcx.region_outlives_predicate(data, &obligation.cause);
431+
infcx.register_region_outlives_constraint(data, &obligation.cause);
432432
}
433433

434434
ProcessResult::Changed(Default::default())
@@ -439,7 +439,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
439439
r_b,
440440
))) => {
441441
if infcx.considering_regions {
442-
infcx.type_outlives_predicate_with_cause(t_a, r_b, &obligation.cause);
442+
infcx.register_type_outlives_constraint(t_a, r_b, &obligation.cause);
443443
}
444444
ProcessResult::Changed(Default::default())
445445
}

compiler/rustc_trait_selection/src/traits/outlives_bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn implied_outlives_bounds<'a, 'tcx>(
8181
let QueryRegionConstraints { outlives } = constraints;
8282
let cause = ObligationCause::misc(span, body_id);
8383
for &(predicate, _) in &outlives {
84-
infcx.outlives_predicate_with_cause(predicate, &cause);
84+
infcx.register_outlives_constraint(predicate, &cause);
8585
}
8686
};
8787

compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::ops::ControlFlow;
22

3-
use rustc_infer::infer::RegionObligation;
3+
use rustc_infer::infer::TypeOutlivesConstraint;
44
use rustc_infer::infer::canonical::CanonicalQueryInput;
55
use rustc_infer::traits::query::OutlivesBound;
66
use rustc_infer::traits::query::type_op::ImpliedOutlivesBounds;
@@ -141,7 +141,7 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
141141
&& !ocx.infcx.tcx.sess.opts.unstable_opts.no_implied_bounds_compat
142142
&& ty.visit_with(&mut ContainsBevyParamSet { tcx: ocx.infcx.tcx }).is_break()
143143
{
144-
for RegionObligation { sup_type, sub_region, .. } in
144+
for TypeOutlivesConstraint { sup_type, sub_region, .. } in
145145
ocx.infcx.take_registered_region_obligations()
146146
{
147147
let mut components = smallvec![];

0 commit comments

Comments
 (0)