-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Avoid processing feature
s on unconfigured crates
#34969
Conversation
Why a compile fail test? Isn't the idea that disabling the crate with |
@retep998 This test still tests that |
For example #![cfg(feature = "nightly")]
#![feature(some_feature)]
#[test] fn foo() {
// code which relies on some_feature
} If the nightly feature isn't enabled, it will compile on the current stable. However it will not compile in the current beta (or at least whatever is on the current playground). The regression is that the stability check for features is done even when the entire crate is disabled with a cfg. So the correct test would need to make sure that this example would still compile in a stable environment where features are disabled. And |
@retep998 I know, this fixes that regression. The test I added is equivalent since features are stability checked when they are processed, so testing that features are not processed also tests that they are not stability checked. If you know of a more direct way to test this, let me know -- I'm not sure how to add a test with stable/beta feature stability checking. |
// compile-flags:--test
// rustc-env:RUSTC_BOOTSTRAP_KEY=
#![cfg(feature="does-not-exist")]
#![feature(iter_arith_traits)]
// nothing below actually matters, but I added it anyway
#[test]
fn dummy() {
let () = "this should not reach type-checking";
panic!("this should not run");
} At least when building beta/stable, this test will require no |
You could add a |
0b77cb1
to
3efff95
Compare
LGTM. cc @alexcrichton Is this the best we can do about testing? |
I don't have too many opinions, so for me if it works it works! |
// except according to those terms. | ||
|
||
// compile-flags:--test | ||
// rustc-env:RUSTC_BOOTSTRAP_KEY= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll also need (found by Travis):
// ignore-pretty : (#23623) problems when ending with // comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
3efff95
to
64d36cc
Compare
@bors: r+ |
📌 Commit 64d36cc has been approved by |
⌛ Testing commit 64d36cc with merge bc81a3f... |
💔 Test failed - auto-win-gnu-32-opt |
@bors: retry On Sun, Jul 24, 2016 at 11:24 PM, bors notifications@github.com wrote:
|
@bors: retry |
⌛ Testing commit 64d36cc with merge 362d04d... |
💔 Test failed - auto-win-msvc-64-opt |
@bors: retry On Tue, Jul 26, 2016 at 3:36 AM, bors notifications@github.com wrote:
|
Avoid processing `feature`s on unconfigured crates Fixes rust-lang#34932, a regression caused by rust-lang#34272. r? @nrc
Accepting for backport: regression, small. |
Fixes #34932, a regression caused by #34272.
r? @nrc