Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use parens for grouping in patterns #11144

Closed
huonw opened this issue Dec 26, 2013 · 2 comments
Closed

Cannot use parens for grouping in patterns #11144

huonw opened this issue Dec 26, 2013 · 2 comments
Labels
A-grammar Area: The grammar of Rust

Comments

@huonw
Copy link
Member

huonw commented Dec 26, 2013

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.

@ghost
Copy link

ghost commented Dec 6, 2014

Closing this as a dupe of #19580.

@ghost ghost closed this as completed Dec 6, 2014
@ftxqxd
Copy link
Contributor

ftxqxd commented Dec 7, 2014

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.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 31, 2023
…ogiq

Rewrite [`tuple_array_conversions`]

Fixes rust-lang#11100
Fixes rust-lang#11144
Fixes rust-lang#11124

rust-lang#11082 still needs discussion and rust-lang#11085 likely can't be fixed.

changelog: [`tuple_array_conversions`]: Move to `pedantic`
changelog: [`tuple_array_conversions`]: Don't lint if mutability of references changes
changelog: [`tuple_array_conversions`]: Don't lint if bindings don't come from the exact same pattern
changelog: [`tuple_array_conversions`]: Don't lint if bindings are used for more than just the conversion
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: The grammar of Rust
Projects
None yet
Development

No branches or pull requests

2 participants