Summary
Several borrowck diagnostic paths only pattern-match ty::Closure, so async/coroutine closures (ty::CoroutineClosure) get weaker or missing help:
mutability_errors.rs – mutating an upvar only calls show_mutating_upvar when the place type is ty::Closure (two sites: direct local and via ty::Ref(_, ty, Mut)).
conflict_errors.rs – needs_note suppresses the generic move note only for ty::Closure with a closure_kind_origin; coroutine closures always get the extra note even when a better origin note applies.
Related paths were already fixed in describe_field / moved-or-invoked notes (issue/PR cluster around #576 / #569).
Origin
Audit of incomplete CoroutineClosure match arms in borrowck diagnostics, SebTardif/rust fork of rust-lang/rust.
Affected code (upstream tip at audit time)
https://github.com/rust-lang/rust/blob/f28ac764c36/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs#L468-L470
https://github.com/rust-lang/rust/blob/f28ac764c36/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs#L521-L525
https://github.com/rust-lang/rust/blob/f28ac764c36/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs#L276-L281
Suggested fix
Use ty::Closure(id, _) | ty::CoroutineClosure(id, _) in all three sites (same pattern as PR #576 on diagnostics/mod.rs).
Impact
Low. Wrong/missing suggestions and notes for async-closure borrow errors, not incorrect accept/reject of programs.
Related
Summary
Several borrowck diagnostic paths only pattern-match
ty::Closure, so async/coroutine closures (ty::CoroutineClosure) get weaker or missing help:mutability_errors.rs– mutating an upvar only callsshow_mutating_upvarwhen the place type isty::Closure(two sites: direct local and viaty::Ref(_, ty, Mut)).conflict_errors.rs–needs_notesuppresses the generic move note only forty::Closurewith aclosure_kind_origin; coroutine closures always get the extra note even when a better origin note applies.Related paths were already fixed in describe_field / moved-or-invoked notes (issue/PR cluster around #576 / #569).
Origin
Audit of incomplete
CoroutineClosurematch arms in borrowck diagnostics, SebTardif/rust fork of rust-lang/rust.Affected code (upstream tip at audit time)
https://github.com/rust-lang/rust/blob/f28ac764c36/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs#L468-L470
https://github.com/rust-lang/rust/blob/f28ac764c36/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs#L521-L525
https://github.com/rust-lang/rust/blob/f28ac764c36/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs#L276-L281
Suggested fix
Use
ty::Closure(id, _) | ty::CoroutineClosure(id, _)in all three sites (same pattern as PR #576 ondiagnostics/mod.rs).Impact
Low. Wrong/missing suggestions and notes for async-closure borrow errors, not incorrect accept/reject of programs.
Related