Skip to content

Commit

Permalink
Rollup merge of rust-lang#134827 - compiler-errors:borrowck-nits, r=lqd
Browse files Browse the repository at this point in the history
Some random region tweaks

Remove a redundant function and add an assertion that I think is useful
  • Loading branch information
dtolnay authored and poliorcetics committed Dec 28, 2024
2 parents 2373909 + 85aad52 commit 9c32a49
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_borrowck/src/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ pub(crate) fn type_check<'a, 'tcx>(
&mut constraints,
);

let pre_obligations = infcx.take_registered_region_obligations();
assert!(
pre_obligations.is_empty(),
"there should be no incoming region obligations = {pre_obligations:#?}",
);

debug!(?normalized_inputs_and_output);

let mut typeck = TypeChecker {
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_infer/src/infer/region_constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,6 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
self.storage.var_infos.len()
}

pub fn region_constraint_data(&self) -> &RegionConstraintData<'tcx> {
&self.storage.data
}

/// Takes (and clears) the current set of constraints. Note that
/// the set of variables remains intact, but all relationships
/// between them are reset. This is used during NLL checking to
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
let outlives_env = OutlivesEnvironment::new(full_env);
let _ = infcx.process_registered_region_obligations(&outlives_env, |ty, _| Ok(ty));

let region_data =
infcx.inner.borrow_mut().unwrap_region_constraints().region_constraint_data().clone();
let region_data = infcx.inner.borrow_mut().unwrap_region_constraints().data().clone();

let vid_to_region = self.map_vid_to_region(&region_data);

Expand Down

0 comments on commit 9c32a49

Please sign in to comment.