Skip to content

Cannot use parens for grouping in patterns #11144

Closed
@huonw

Description

@huonw
Member
fn main() {
    let &mut _ok = &1;
    let &(mut _error) = &1;
}
paren-pat.rs:3:20: 3:21 error: expected `,` but found `)`
paren-pat.rs:3     let &(mut _error) = &1;
                                   ^

This is a very minor papercut for when one wish to clarify exactly what a pattern is doing; the example above is the main situation in which I've wanted parens, making it clear that it's a & pattern + a mutable ident binding, rather than a (hypothetical) &mut pattern.

Activity

ghost

ghost commented on Dec 6, 2014

@ghost

Closing this as a dupe of #19580.

ghost closed this as completedon Dec 6, 2014
ftxqxd

ftxqxd commented on Dec 7, 2014

@ftxqxd
Contributor

I don’t really understand how this was closed as a dupe rather than #19580. How can this be a dupe of a more recent and less general issue? And in any case, I think that this issue is probably RFC-like enough to belong in the RFCs repo.

added a commit that references this issue on Jul 31, 2023

Auto merge of rust-lang#11171 - Centri3:tuple_array_conversions, r=ll…

747df85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of Rust

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @huonw@ftxqxd

        Issue actions

          Cannot use parens for grouping in patterns · Issue #11144 · rust-lang/rust