1
Fork 0

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

@ -1772,10 +1772,10 @@ impl<'tcx> Region<'tcx> {
matches!(self.kind(), ty::ReVar(_))
}
pub fn as_var(self) -> Option<RegionVid> {
pub fn as_var(self) -> RegionVid {
match self.kind() {
ty::ReVar(vid) => Some(vid),
_ => None,
ty::ReVar(vid) => vid,
_ => bug!("expected region {:?} to be of kind ReVar", self),
}
}
}