simplify UniversalRegions::to_region_vid
to just consult the map
This doesn't actually fix the bug, but seems better.
This commit is contained in:
parent
27ede55414
commit
bf02c57b16
@ -799,10 +799,12 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
|
|||||||
/// during initialization. Relies on the `indices` map having been
|
/// during initialization. Relies on the `indices` map having been
|
||||||
/// fully initialized.
|
/// fully initialized.
|
||||||
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
|
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
|
||||||
match r {
|
if let ty::ReVar(..) = r {
|
||||||
ty::ReEarlyBound(..) | ty::ReStatic => *self.indices.get(&r).unwrap(),
|
r.to_region_vid()
|
||||||
ty::ReVar(..) => r.to_region_vid(),
|
} else {
|
||||||
_ => bug!("cannot convert `{:?}` to a region vid", r),
|
*self.indices.get(&r).unwrap_or_else(|| {
|
||||||
|
bug!("cannot convert `{:?}` to a region vid", r)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user