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

Parse unparenthesized half-open range patterns inside slice patterns #1769

Open
dtolnay opened this issue Oct 23, 2024 · 0 comments
Open

Parse unparenthesized half-open range patterns inside slice patterns #1769

dtolnay opened this issue Oct 23, 2024 · 0 comments
Labels

Comments

@dtolnay
Copy link
Owner

dtolnay commented Oct 23, 2024

https://github.com/rust-lang/rust/blob/be01dabfefd2daa4574b974f571c7852085d60cb/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs#L42C9-L42C25

match x {
    &[1..] => {}
    _ => {}
}

Syn currently rejects this syntax.

error: range pattern is not allowed unparenthesized inside slice pattern
  --> tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs:42:12
   |
42 |         &[1..] => false,
   |            ^^
@dtolnay dtolnay added the syntax label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant