-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Don't allow const
to begin a nonterminal
#80135
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks to Vadim Petrochenkov who [told me what the fix was][z]! [z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/finding.20which.20macro.20rule.20to.20use/near/220240422
Beta-nominating because this fixes a P-critical regression from stable to beta. |
@bors r+ rollup |
📌 Commit d6f1787 has been approved by |
Should this be p=1 because it fixes a P-critical regression? |
Likewise, I don't think this should be |
RalfJung
added a commit
to RalfJung/rust
that referenced
this pull request
Dec 18, 2020
Don't allow `const` to begin a nonterminal Fixes rust-lang#79908. Thanks to Vadim Petrochenkov who [told me what the fix was][z]! [z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/finding.20which.20macro.20rule.20to.20use/near/220240422 r? `@petrochenkov`
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 18, 2020
Rollup of 6 pull requests Successful merges: - rust-lang#80121 (Change the message for `if_let_guard` feature gate) - rust-lang#80130 (docs: Edit rustc_span::symbol::Symbol method) - rust-lang#80135 (Don't allow `const` to begin a nonterminal) - rust-lang#80145 (Fix typo in rustc_typeck docs) - rust-lang#80146 (Edit formatting in Rust Prelude docs) - rust-lang#80147 (Add missing punctuation to std::alloc docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Ok, looks like the questions above already resolved themselves without my involvement. |
Oh well :) |
Merged
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 28, 2020
…ulacrum [beta] backports This backports the following to 1.49: * Revert change to trait evaluation order rust-lang#80132 * Don't allow `const` to begin a nonterminal rust-lang#80135 * Prevent caching normalization results with a cycle rust-lang#80246 r? `@Mark-Simulacrum`
lf-
added a commit
to lf-/rust
that referenced
this pull request
Apr 26, 2021
This makes it possible to use `inline_const` (rust-lang#76001) and `let_chains` (rust-lang#53667) inside macros' `expr` patterns in a future edition by bifurcating the `expr` nonterminal in a similar way to `pat2021` to remove some backwards compatibility exceptions that disallow `const`/`let` at the beginning of an `expr` match. Fixes rust-lang#84155 and relaxes the backward compat restriction from rust-lang#80135 for a future edition. This is not intended to go into 2021 as it I don't think it's simple to write an automatic fix, and certainly not now that it's past the soft deadline for inclusion in 2021 by a long shot. Here is a pathological case of rust-lang#79908 that forces this to be an edition change: ```rust macro_rules! evil { ($e:expr) => { // or something else const {$e-1} }; (const $b:block) => { const {$b} } } fn main() { let x = 5; match x { evil!(const { 5 }) => panic!("oh no"), _ => (), }; } ```
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-parser
Area: The lexing & parsing of Rust source code to an AST
beta-accepted
Accepted for backporting to the compiler in the beta channel.
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #79908.
Thanks to Vadim Petrochenkov who told me what the fix was!
r? @petrochenkov