Avoid processing features on unconfigured crates#34969
Avoid processing features on unconfigured crates#34969bors merged 2 commits intorust-lang:masterfrom
features on unconfigured crates#34969Conversation
|
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! |
src/test/run-pass/issue-34932.rs
Outdated
There was a problem hiding this comment.
You'll also need (found by Travis):
// ignore-pretty : (#23623) problems when ending with // comments3efff95 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 [email protected] 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 [email protected] 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