Skip to content

Commit a8b0eb7

Browse files
xizheyinlcnr
andauthored
Update compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Co-authored-by: lcnr <[email protected]>
1 parent c7272a6 commit a8b0eb7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
198198

199199
/// Returns `true` if a closure is inferred to be an `FnMut` closure.
200200
fn is_closure_fn_mut(&self, fr: RegionVid) -> bool {
201-
if let Some(ty::ReLateParam(late_param)) = self.to_error_region(fr).map(|r| r.kind())
201+
if let Some(r) = self.to_error_region(fr)
202+
&& let ty::ReLateParam(late_param) = r.kind()
202203
&& let ty::LateParamRegionKind::ClosureEnv = late_param.kind
203204
&& let DefiningTy::Closure(_, args) = self.regioncx.universal_regions().defining_ty
204205
{

0 commit comments

Comments
 (0)