Bug
OpaqueTypeCollector in compiler/rustc_hir_analysis/src/check/check.rs:2199 matches ty::Closure(def_id, ..) | ty::Coroutine(def_id, ..) but is missing ty::CoroutineClosure(def_id, ..).
When an async closure (stable since Rust 1.85) contains references to opaque types, the CoroutineClosure TyKind variant falls through to the default _ => t.super_visit_with(self) arm instead of being pushed onto self.closures. This means the closure def_id is not collected, potentially causing missed opaque type checks for async closures.
Code at fault
// check.rs:2199
ty::Closure(def_id, ..) | ty::Coroutine(def_id, ..) => {
self.closures.push(def_id);
t.super_visit_with(self);
}
Missing: ty::CoroutineClosure(def_id, ..)
Pattern
Same CoroutineClosure-missing-from-match pattern as #477, #478, #479. The CoroutineClosure TyKind variant was added for async closures but many match sites were not updated.
Severity
Diagnostic-only. The closures list is used for opaque type diagnostics, so the impact is limited to potentially missing or incorrect error messages when async closures interact with opaque types.
Bug
OpaqueTypeCollectorincompiler/rustc_hir_analysis/src/check/check.rs:2199matchesty::Closure(def_id, ..) | ty::Coroutine(def_id, ..)but is missingty::CoroutineClosure(def_id, ..).When an async closure (stable since Rust 1.85) contains references to opaque types, the
CoroutineClosureTyKind variant falls through to the default_ => t.super_visit_with(self)arm instead of being pushed ontoself.closures. This means the closure def_id is not collected, potentially causing missed opaque type checks for async closures.Code at fault
Missing:
ty::CoroutineClosure(def_id, ..)Pattern
Same CoroutineClosure-missing-from-match pattern as #477, #478, #479. The
CoroutineClosureTyKind variant was added for async closures but many match sites were not updated.Severity
Diagnostic-only. The
closureslist is used for opaque type diagnostics, so the impact is limited to potentially missing or incorrect error messages when async closures interact with opaque types.