Skip to content

Match ergonomics error message about Rust 2024 future compatibility in Rust 2024 #136456

Closed
@traviscross

Description

@traviscross

In Rust 2024, the following error message is emitted:

//@ edition: 2024
fn main() {
    let [&_x] = &mut [&()];
    //~^ ERROR this pattern relies on behavior which may change in edition 2024
    //~| ERROR cannot implicitly match against multiple layers of reference
    //~| NOTE make the implied reference pattern explicit
}

This message isn't great. The problem isn't really that the behavior may change in Rust 2024, it's that this is simply disallowed (starting in Rust 2024).

We should probably also remove the bit about "implicitly matching against multiple layers of references". If someone is in the Rust 2024 headspace, this isn't necessarily what the person was trying to do in writing this.

cc @Nadrieril @dianne

Tracking:

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-edition-2024Area: The 2024 editionA-patternsRelating to patterns and pattern matchingC-bugCategory: This is a bug.I-edition-triagedIssue: This issue has been reviewed and triaged by the Edition team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions