-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Tracking issue for future-incompatbility warning 'invalid literal suffix on tuple index' (not a lint) #60210
Copy link
Copy link
Closed
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-future-incompatibilityCategory: Future-incompatibility lintsCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Idea
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
synorquotecrates. It can be avoided by usingsyn::Index::fromorproc_macro::Literal::*_unsuffixed. For example, if before you were generatingfoo.0doing 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: