Skip to content

Configuration stripping should happen before checking feature gates #24434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fhahn opened this issue Apr 14, 2015 · 0 comments · Fixed by #24437
Closed

Configuration stripping should happen before checking feature gates #24434

fhahn opened this issue Apr 14, 2015 · 0 comments · Fixed by #24437

Comments

@fhahn
Copy link
Contributor

fhahn commented Apr 14, 2015

At the moment, feature_gate::check_crate_macros is executed before strip_unconfigured_items which leads things like #![cfg_attr(stage0, feature(custom_attribute))] in https://github.com/rust-lang/rust/blob/master/src/libcore/lib.rs#L50 beeing ignored (#![feature(custom_attribute)] is again defined in the same file).

The following test illustrates the problem

// compile-flags:--cfg set1
//
#![cfg_attr(set1, feature(custom_attribute))]

#![foobar]
fn main() {}

It fails with The attributefoobaris currently unknown to the the compiler and may have meaning added to it in the future, because of the problem mentioned above.

fhahn added a commit to fhahn/rust that referenced this issue Apr 14, 2015
bors added a commit that referenced this issue Apr 16, 2015
closes #24434 

This PR changes executes `syntax::config::strip_unconfigured_items` before `syntax::feature_gate::check_crate_macros(sess.codemap()`. As far as I know, `strip_unconfigured_items` should be independent of `check_crate_macros`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant