-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Gracefully handle python-esque sequence slicing #108215
Comments
I'm not sure whether it's worth to fix this right now. #101728 will significantly change this code, basically requiring a rewrite of this diagnostic. |
Agreed, it's reasonable to wait for type ascription removal. |
@hkmatsumoto error: expected one of `.`, `?`, `]`, or an operator, found `:`
--> src/main.rs:2:25
|
2 | let a = &[1, 2, 3][1:2];
| ^ expected one of `.`, `?`, `]`, or an operator
|
= note: type ascription syntax has been removed, [see issue #101728 <https://github.com/rust-lang/rust/issues/101728>](https://github.com/rust-lang/rust/issues/101728)
help: maybe write a path separator here
|
2 | let a = &[1, 2, 3][1::2];
rust/compiler/rustc_parse/src/parser/stmt.rs Line 563 in cad92b4
|
… r=TaKO8Ki Detect Python-like slicing and suggest how to fix Fix rust-lang#108215
… r=TaKO8Ki Detect Python-like slicing and suggest how to fix Fix rust-lang#108215
… r=TaKO8Ki Detect Python-like slicing and suggest how to fix Fix rust-lang#108215
Rollup merge of rust-lang#111133 - hkmatsumoto:handle-python-slicing, r=TaKO8Ki Detect Python-like slicing and suggest how to fix Fix rust-lang#108215
Code
Current output
Desired output
help: did you mean [1..2]?
Rationale and extra context
Having written Python for several hours, I made this mistake and couldn't realize what was wrong for a while.
Other cases
No response
Anything else?
@rustbot claim
The text was updated successfully, but these errors were encountered: