-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ast_validation: forbid "nonstandard" literal patterns #43844
Conversation
@bors r+ |
📌 Commit 3dfc8a6 has been approved by |
src/test/compile-fail/issue-43250.rs
Outdated
macro_rules! m { | ||
($a:expr) => { | ||
let $a = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙅 Tabs found by tidy.
[00:04:00] tidy error: /checkout/src/test/compile-fail/issue-43250.rs:15: tab character
[00:04:00] tidy error: /checkout/src/test/compile-fail/issue-43250.rs:16: tab character
[00:04:00] tidy error: /checkout/src/test/compile-fail/issue-43250.rs:17: tab character
[00:04:00] tidy error: /checkout/src/librustc_passes/ast_validation.rs:106: tab character
[00:04:00] tidy error: /checkout/src/librustc_passes/ast_validation.rs:107: tab character
[00:04:00] tidy error: /checkout/src/librustc_passes/ast_validation.rs:108: tab character
[00:04:00] some tidy checks failed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the original testcase was tainted :(.
/// macro_rules! m { | ||
/// ($a:expr) => { | ||
/// let $a = S; | ||
/// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs also found in the 3 lines above.
@bors r- |
Since rust-lang#42886, macros can create "nonstandard" PatKind::Lit patterns, that contain path expressions instead of the usual literal expr. These can cause trouble, including ICEs. We *could* map these nonstandard patterns to PatKind::Path patterns during HIR lowering, but that would be much effort for little gain, and I think is too risky for beta. So let's just forbid them during AST validation. Fixes rust-lang#43250.
3dfc8a6
to
a2adb7d
Compare
No more tabs! @bors r=eddyb |
📌 Commit a2adb7d has been approved by |
ast_validation: forbid "nonstandard" literal patterns Since #42886, macros can create "nonstandard" PatKind::Lit patterns, that contain path expressions instead of the usual literal expr. These can cause trouble, including ICEs. We *could* map these nonstandard patterns to PatKind::Path patterns during HIR lowering, but that would be much effort for little gain, and I think is too risky for beta. So let's just forbid them during AST validation. Fixes #43250. beta-nominating because regression. r? @eddyb
☀️ Test successful - status-appveyor, status-travis |
Accepted for beta backport. Small patch, regression. cc @rust-lang/compiler |
Since #42886, macros can create "nonstandard" PatKind::Lit patterns,
that contain path expressions instead of the usual literal expr. These
can cause trouble, including ICEs.
We could map these nonstandard patterns to PatKind::Path patterns
during HIR lowering, but that would be much effort for little gain, and
I think is too risky for beta. So let's just forbid them during AST
validation.
Fixes #43250.
beta-nominating because regression.
r? @eddyb