Make Region::as_var infallible.

It's what all the call sites require.
This commit is contained in:
Nicholas Nethercote
2023-04-12 15:36:03 +10:00
parent 9693b178fc
commit c802694bda
3 changed files with 7 additions and 18 deletions

View File

@@ -507,9 +507,7 @@ impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
F: Fn() -> RegionCtxt,
{
let next_region = self.infcx.next_region_var(origin);
let vid = next_region
.as_var()
.unwrap_or_else(|| bug!("expected RegionKind::RegionVar on {:?}", next_region));
let vid = next_region.as_var();
if cfg!(debug_assertions) && !self.inside_canonicalization_ctxt() {
debug!("inserting vid {:?} with origin {:?} into var_to_origin", vid, origin);
@@ -531,9 +529,7 @@ impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
F: Fn() -> RegionCtxt,
{
let next_region = self.infcx.next_nll_region_var(origin.clone());
let vid = next_region
.as_var()
.unwrap_or_else(|| bug!("expected RegionKind::RegionVar on {:?}", next_region));
let vid = next_region.as_var();
if cfg!(debug_assertions) && !self.inside_canonicalization_ctxt() {
debug!("inserting vid {:?} with origin {:?} into var_to_origin", vid, origin);