update if let to match in universal_regions.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
parent
a8b0eb7c65
commit
c66d35e946
1 changed files with 11 additions and 11 deletions
|
@ -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)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue