Skip to content

Commit 2d96f2a

Browse files
authored
Rollup merge of #134827 - compiler-errors:borrowck-nits, r=lqd
Some random region tweaks Remove a redundant function and add an assertion that I think is useful
2 parents 9aebd28 + 85aad52 commit 2d96f2a

File tree

3 files changed

+7
-6
lines changed
  • compiler
    • rustc_borrowck/src/type_check
    • rustc_infer/src/infer/region_constraints
    • rustc_trait_selection/src/traits

3 files changed

+7
-6
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ pub(crate) fn type_check<'a, 'tcx>(
140140
&mut constraints,
141141
);
142142

143+
let pre_obligations = infcx.take_registered_region_obligations();
144+
assert!(
145+
pre_obligations.is_empty(),
146+
"there should be no incoming region obligations = {pre_obligations:#?}",
147+
);
148+
143149
debug!(?normalized_inputs_and_output);
144150

145151
let mut typeck = TypeChecker {

compiler/rustc_infer/src/infer/region_constraints/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
299299
self.storage.var_infos.len()
300300
}
301301

302-
pub fn region_constraint_data(&self) -> &RegionConstraintData<'tcx> {
303-
&self.storage.data
304-
}
305-
306302
/// Takes (and clears) the current set of constraints. Note that
307303
/// the set of variables remains intact, but all relationships
308304
/// between them are reset. This is used during NLL checking to

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
161161
let outlives_env = OutlivesEnvironment::new(full_env);
162162
let _ = infcx.process_registered_region_obligations(&outlives_env, |ty, _| Ok(ty));
163163

164-
let region_data =
165-
infcx.inner.borrow_mut().unwrap_region_constraints().region_constraint_data().clone();
164+
let region_data = infcx.inner.borrow_mut().unwrap_region_constraints().data().clone();
166165

167166
let vid_to_region = self.map_vid_to_region(&region_data);
168167

0 commit comments

Comments
 (0)