Skip to content

Spans for errors in try operator expressions are not great #42234

Closed
@nrc

Description

@nrc

E.g.,

error: the type of this value must be known in this context
   --> src/librustc_save_analysis/sig.rs:281:39
    |
281 |             let generics: Signature = generics.make(offset + text.len(), id, scx)?;
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

the expression with unknown type is the variable use generics, but the error highlight covers the entire sub-expression of expr?. I assume this is due to us doing something sub-optimal with the spans here in the HIR lowering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-HIRArea: The high-level intermediate representation (HIR)A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions