Skip to content

Avoid type mismatch error where a variable is bound with different ref-ness #30418

Open
@nrc

Description

@nrc

e.g.,

match x {
      opts::a(ref i) | opts::b(i) => {}
      //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
      //~^^ ERROR mismatched types

Where the field of a and b has the same type

cc #30320

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-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