Skip to content

ast_validation: forbid "nonstandard" literal patterns - #43844

Merged
bors merged 1 commit into
rust-lang:masterfrom
arielb1:literally-nonstandard
Aug 14, 2017
Merged

ast_validation: forbid "nonstandard" literal patterns#43844
bors merged 1 commit into
rust-lang:masterfrom
arielb1:literally-nonstandard

Conversation

@arielb1

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Aug 13, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 3dfc8a6 has been approved by eddyb

Comment threadsrc/test/compile-fail/issue-43250.rs Outdated

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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 :(.

Copy link
Copy Markdown
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
Copy Markdown
Contributor

@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.
Fixesrust-lang#43250.
@arielb1
arielb1force-pushed the literally-nonstandard branch from 3dfc8a6 to a2adb7dCompareAugust 13, 2017 15:35
@arielb1

Copy link
Copy Markdown
ContributorAuthor

No more tabs!

@bors r=eddyb

@bors

bors commented Aug 13, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit a2adb7d has been approved by eddyb

@bors

bors commented Aug 14, 2017

Copy link
Copy Markdown
Collaborator

⌛ 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

bors commented Aug 14, 2017

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
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
@alexcrichtonalexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 23, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-acceptedAccepted for backporting to the compiler in the beta channel.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@arielb1@eddyb@bors@nikomatsakis@kennytm@alexcrichton