Skip to content

borrowck: detect FnMut for CoroutineClosure in region error helpers#608

Open
SebTardif wants to merge 1 commit into
mainfrom
fix-r77-region-errors-cc-fn-mut
Open

borrowck: detect FnMut for CoroutineClosure in region error helpers#608
SebTardif wants to merge 1 commit into
mainfrom
fix-r77-region-errors-cc-fn-mut

Conversation

@SebTardif

Copy link
Copy Markdown
Owner

Fixes #606

Summary

is_closure_fn_mut now recognizes DefiningTy::CoroutineClosure and checks as_coroutine_closure().kind() == FnMut, so region diagnostics that branch on this helper behave correctly for async/coroutine closures.

Origin

Compiler audit (CoroutineClosure region diagnostic gaps), SebTardif/rust.

Test plan

  • Diagnostic helper only; no semantic borrowck change.
  • Coroutine-closure MIR with FnMut kind should report as FnMut via is_closure_fn_mut.

`is_closure_fn_mut` only considered `DefiningTy::Closure`, so region
diagnostics for async/coroutine closures never treated `ClosureEnv` as
`FnMut` even when the coroutine-closure kind was `FnMut`. Include
`DefiningTy::CoroutineClosure` via `as_coroutine_closure().kind()`.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

borrowck: is_closure_fn_mut ignores DefiningTy::CoroutineClosure

1 participant