We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
UniversalRegions::to_region_vid
1 parent 27ede55 commit bf02c57Copy full SHA for bf02c57
src/librustc_mir/borrow_check/nll/universal_regions.rs
@@ -799,10 +799,12 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
799
/// during initialization. Relies on the `indices` map having been
800
/// fully initialized.
801
pub fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
802
- match r {
803
- ty::ReEarlyBound(..) | ty::ReStatic => *self.indices.get(&r).unwrap(),
804
- ty::ReVar(..) => r.to_region_vid(),
805
- _ => bug!("cannot convert `{:?}` to a region vid", r),
+ if let ty::ReVar(..) = r {
+ r.to_region_vid()
+ } else {
+ *self.indices.get(&r).unwrap_or_else(|| {
806
+ bug!("cannot convert `{:?}` to a region vid", r)
807
+ })
808
}
809
810
0 commit comments