1
Fork 0

update if let to match in universal_regions.rs

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
xizheyin 2025-04-08 17:39:15 +08:00
parent a8b0eb7c65
commit c66d35e946
No known key found for this signature in database
GPG key ID: 0A0D90BE99CEDEAD

View file

@ -909,19 +909,19 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
/// if it is a placeholder. Handling placeholders requires access to the /// if it is a placeholder. Handling placeholders requires access to the
/// `MirTypeckRegionConstraints`. /// `MirTypeckRegionConstraints`.
fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid { fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
if let ty::ReVar(..) = r.kind() { match r.kind() {
r.as_var() ty::ReVar(..) => r.as_var(),
} else if let ty::ReError(guar) = r.kind() { ty::ReError(guar) => {
self.tainted_by_errors.set(Some(guar)); self.tainted_by_errors.set(Some(guar));
// We use the `'static` `RegionVid` because `ReError` doesn't actually exist in the // We use the `'static` `RegionVid` because `ReError` doesn't actually exist in the
// `UniversalRegionIndices`. This is fine because 1) it is a fallback only used if // `UniversalRegionIndices`. This is fine because 1) it is a fallback only used if
// errors are being emitted and 2) it leaves the happy path unaffected. // errors are being emitted and 2) it leaves the happy path unaffected.
self.fr_static self.fr_static
} else { }
*self _ => *self
.indices .indices
.get(&r) .get(&r)
.unwrap_or_else(|| bug!("cannot convert `{:?}` to a region vid", r)) .unwrap_or_else(|| bug!("cannot convert `{:?}` to a region vid", r)),
} }
} }