Skip to content

Multiple diagnostic paths missing CoroutineClosure, worse async closure error messages #490

@SebTardif

Description

@SebTardif

Bug

Multiple diagnostic and lint code paths match ty::Closure and/or ty::Coroutine but miss ty::CoroutineClosure, producing less precise error messages or lint false negatives for async closures.

Affected locations

File Line Impact
rustc_borrowck/src/diagnostics/explain_borrow.rs 213 Shows raw type instead of "closure" for async closure destructors
rustc_borrowck/src/diagnostics/region_errors.rs 182 is_closure_fn_mut returns false for async FnMut closures, causing less specific region error
rustc_lint/src/dangling.rs 105 DANGLING_POINTERS_FROM_LOCALS lint silently skips async closures
rustc_hir_analysis/src/hir_ty_lowering/errors.rs 973 Missing "point at closure" span for async closure trait bound failures
rustc_hir_typeck/src/fn_ctxt/checks.rs 1400, 1628 Missing "callable defined here" note and call-site matching for async closures
rustc_hir_typeck/src/method/suggest.rs 1827 Missing "point at closure" span in method resolution errors (same pattern as hir_ty_lowering)
rustc_trait_selection/src/error_reporting/infer/mod.rs 1782, 1850, 2556 Missing "closure has signature" note, missing "does not fulfill lifetime" suggestion, and missing TyCategory for async closures

Pattern

Same CoroutineClosure-missing-from-match pattern found across Rounds 63-64. Each is a one-line addition of ty::CoroutineClosure(..) to an existing match arm.

Severity

All P-low, diagnostic/lint quality only. No ICEs or wrong codegen. The most impactful is the dangling.rs lint false negative, which silently skips async closures returning dangling pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsCompiler diagnosticsI-wrongWrong result or data corruptionP-lowLow impact: edge case or niche scenariobugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions