Skip to content

[1.30 beta] Regression in cfg attribute parsing #54463

Closed
@pietroalbini

Description

@pietroalbini
Member

Parsing of the following snippet is failing on Rust 1.30 beta:

#![cfg_attr(feature = "nightly", feature(plugin_registrar, rustc_private,quote,),)]

cc @petrochenkov

Activity

added
A-parserArea: The lexing & parsing of Rust source code to an AST
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Sep 22, 2018
added this to the 1.30 milestone on Sep 22, 2018
petrochenkov

petrochenkov commented on Sep 22, 2018

@petrochenkov
Contributor

Most probably caused by #53893.
I wonder why the previous crater run didn't caught this.

self-assigned this
on Sep 22, 2018
eddyb

eddyb commented on Sep 22, 2018

@eddyb
Member

@petrochenkov According to @pietroalbini, before and after had the same error (for #53893).
Is it possible a (different?) regression landed on master before that crater run?

pietroalbini

pietroalbini commented on Sep 22, 2018

@pietroalbini
MemberAuthor

The regression is caused by #53293, which didn't go through a Crater run.

petrochenkov

petrochenkov commented on Sep 23, 2018

@petrochenkov
Contributor

(plugin_registrar, rustc_private,quote,), after the attribute path feature was parsed as an arbitrary token stream containing two token trees - parenthesized group (...) and comma ,.

Arbitrary token streams were never supposed to work on stable channel, but this wasn't properly enforced.
In particular, the unstable syntax was usable in code that's cfg-ed out.
The point of #53293 was exactly to fix this hole, so I think this issue is WONTFIX, as stated by rust-lang/rfcs#2405, especially given that this is the only regression of this kind and the code in command-macros was fixed long ago.

Note, that #![cfg_attr(feature = "nightly", feature(plugin_registrar, rustc_private,quote,),)] doesn't compile on stable if feature = "nightly" is actually enabled.

petrochenkov

petrochenkov commented on Sep 24, 2018

@petrochenkov
Contributor

We can accept trailing comma in cfg_attr specifically though.
It will need to be accepted anyway when rust-lang/rfcs#2539 is implemented.

petrochenkov

petrochenkov commented on Sep 26, 2018

@petrochenkov
Contributor

Fixed in #54581

added a commit that references this issue on Sep 27, 2018

Rollup merge of rust-lang#54581 - petrochenkov:cfgattr, r=alexcrichton

5303b59
added a commit that references this issue on Sep 27, 2018

Auto merge of #54581 - petrochenkov:cfgattr, r=alexcrichton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @eddyb@pietroalbini@petrochenkov

      Issue actions

        [1.30 beta] Regression in cfg attribute parsing · Issue #54463 · rust-lang/rust