Skip to content
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

Merged
merged 1 commit into from
Aug 14, 2017

Conversation

arielb1
Copy link
Contributor

@arielb1 arielb1 commented Aug 13, 2017

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

@arielb1 arielb1 added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 13, 2017
@eddyb
Copy link
Member

eddyb commented Aug 13, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Aug 13, 2017

📌 Commit 3dfc8a6 has been approved by eddyb

macro_rules! m {
($a:expr) => {
let $a = 0;
}
Copy link
Member

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

Copy link
Member

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;
/// }
Copy link
Member

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.

@eddyb
Copy link
Member

eddyb commented Aug 13, 2017

@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.
@arielb1 arielb1 force-pushed the literally-nonstandard branch from 3dfc8a6 to a2adb7d Compare August 13, 2017 15:35
@arielb1
Copy link
Contributor Author

arielb1 commented Aug 13, 2017

No more tabs!

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Aug 13, 2017

📌 Commit a2adb7d has been approved by eddyb

@bors
Copy link
Contributor

bors commented Aug 14, 2017

⌛ Testing commit a2adb7d with merge bae4faf...

bors added a commit that referenced this pull request Aug 14, 2017
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
@bors
Copy link
Contributor

bors commented Aug 14, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing bae4faf to master...

@bors bors merged commit a2adb7d into rust-lang:master Aug 14, 2017
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Aug 23, 2017
@nikomatsakis
Copy link
Contributor

Accepted for beta backport. Small patch, regression.

cc @rust-lang/compiler

bors added a commit that referenced this pull request Aug 23, 2017
[beta] Final round of beta backports

Includes:

* [x] #43723
* [x] #43830
* [x] #43844
* [x] #44013
* [x] #44049
* [x] #43948
@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 23, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants