diff options
| author | xizheyin <xizheyin@smail.nju.edu.cn> | 2025-04-08 17:36:44 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-08 17:36:44 +0800 |
| commit | a8b0eb7c65bba72de8bc5cd5068a46ab4563d201 (patch) | |
| tree | afb9597b09f0d89b28c1d25dccc288eaf7c31a3f | |
| parent | c7272a6cbc999a187d564624594889532e47ffa0 (diff) | |
| download | rust-a8b0eb7c65bba72de8bc5cd5068a46ab4563d201.tar.gz rust-a8b0eb7c65bba72de8bc5cd5068a46ab4563d201.zip | |
Update compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Co-authored-by: lcnr <rust@lcnr.de>
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/region_errors.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 5b5cacdf4c8..8d530b51636 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -198,7 +198,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// Returns `true` if a closure is inferred to be an `FnMut` closure. fn is_closure_fn_mut(&self, fr: RegionVid) -> bool { - if let Some(ty::ReLateParam(late_param)) = self.to_error_region(fr).map(|r| r.kind()) + if let Some(r) = self.to_error_region(fr) + && let ty::ReLateParam(late_param) = r.kind() && let ty::LateParamRegionKind::ClosureEnv = late_param.kind && let DefiningTy::Closure(_, args) = self.regioncx.universal_regions().defining_ty { |
