-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Tracking issue for future-incompatbility warning 'invalid literal suffix on tuple index' (not a lint) #60210
Comments
The existing behavior only worked because of rust-lang/rust#60210.
Transition some C-future-compatibility lints to {ERROR, DENY} Closes #40107 (ERROR). Closes #39207 (ERROR). Closes #37872 (ERROR). Closes #36887 (ERROR). Closes #36247 (ERROR. Closes #42238 (ERROR). Transitions #59014 (DENY). Transitions #57571 (DENY). Closes #60210 (ERROR). Transitions #35203 (DENY). r? @petrochenkov
This comment has been minimized.
This comment has been minimized.
It appears to be impossible to promote this warning to an error? I've been trying to write a regression test in a proc macro to catch this error, but to no avail. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=933b66f963f15bda1c3b62d0ae19e517 |
Good catch! This warning was never assigned to a specific lint (whether intentional or not). We should address that. |
This is the summary issue for a bug fix related to tuple indexing. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.
What is the warning for?
As reported in #59418, the compiler incorrectly accepts
foo.0_u32
(and other suffixes) when indexing into tuples. The expected syntax is simplyfoo.0
. We are presently issuing warnings when this incorrect syntax is used but we expect to transition those warnings to errors in the future.How can you fix your code?
Most often this error manifests in procedural macros that employ the
syn
orquote
crates. It can be avoided by usingsyn::Index::from
orproc_macro::Literal::*_unsuffixed
. For example, if before you were generatingfoo.0
doing something like this:you might now do instead:
When will this warning become a hard error?
At the beginning of each 6-week release cycle, the Rust compiler team
will review the set of outstanding future compatibility warnings and
nominate some of them for Final Comment Period. Toward the end of
the cycle, we will review any comments and make a final determination
whether to convert the warning into a hard error or remove it
entirely.
Related bugs
Here are some of the regressions found in the wild:
The text was updated successfully, but these errors were encountered: