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

driver: Disallow predicates in --cfg specs #31499

Merged
merged 5 commits into from
Feb 10, 2016

Conversation

kamalmarhubi
Copy link
Contributor

A spec like #[cfg(foo(bar))] is not allowed as an attribute. This
makes the same spec be rejected by the compiler if passed in as a
--cfg argument.

Fixes #31495

@kamalmarhubi
Copy link
Contributor Author

r? @brson

@rust-highfive rust-highfive assigned brson and unassigned nikomatsakis Feb 8, 2016
@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

}

if sopts.cfg.iter().any(|item| is_meta_list(&*item)) {
early_error(output, "predicates are not allowed in --cfg");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about error message, or if we should print the offending flags as well. Input welcome!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something "invalid predicate in --cfg command line argument: foo(whatever)", printing the actual argument. That mirrors the in-source error a little better and says where the error is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll make the change after finding out how to print more than one error, since the user could have passed multiple offending flags. (This is my first time in the compiler's code.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kamalmarhubi kamalmarhubi force-pushed the cfg-flag-invalid-cfgs branch from db425a4 to 6d2c866 Compare February 8, 2016 22:16
@kamalmarhubi
Copy link
Contributor Author

@brson any thoughts on whether the check should be in the early_callback or the late_callback?

@brson
Copy link
Contributor

brson commented Feb 9, 2016

@kamalmarhubi early.

@bors r+ Thanks!

@bors
Copy link
Contributor

bors commented Feb 9, 2016

📌 Commit c32c7c2 has been approved by brson

@bors
Copy link
Contributor

bors commented Feb 10, 2016

⌛ Testing commit c32c7c2 with merge 052b3fd...

bors added a commit that referenced this pull request Feb 10, 2016
A spec like `#[cfg(foo(bar))]` is not allowed as an attribute. This
makes the same spec be rejected by the compiler if passed in as a
`--cfg` argument.

Fixes #31495
@bors bors merged commit c32c7c2 into rust-lang:master Feb 10, 2016
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 this pull request may close these issues.

5 participants