-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
rustc_parser incorrectly parses groups with Delimiter::None #67062
Copy link
Copy link
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-langRelevant to the language teamRelevant to the language team
Description
Activity
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-langRelevant to the language teamRelevant to the language team
Such groups can currently be created by proc macros.
Reproduction, proc macro crate:
User crate:
This is not a huge issue right now because proc macros have no reasons to created
Delimiter::Nonedelimiters themselves (but they can still get them from input and return them if they return their input partially or fully, see the example below).However, this will became a huge issue when interpolated tokens like
$e: exprmigrate from AST pieces to token streams, because in the token stream model they are represented exactly like groups withDelimiter::Nonedelimiters (proc macros already see them in this way).