-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Remove #[cfg(not(test))]
gates in core
#138082
Conversation
I only found this comment explaining it after opening this. It seems like doc tests and macros require their own gates, and this commented gate is for everything else. Lines 46 to 56 in 30f168e
I still want to see whether CI passes, as this PR essentially tests the doc test case. |
#[cfg(not(test))]
from core::slice
impl blocks#[cfg(not(test))]
from core
impl blocks
6957db9
to
273aa0b
Compare
Interesting. CI passed with |
It seems these gates were added in #50466 (rustbuild: Allow quick testing of libstd and libcore at stage0, 2018-05-05), including the comment which I quoted above. |
Cc @bjorn3 who knows a lot about the test infra |
These were necessary way back when libcore unit tests were in the same files as the libcore source code to prevent the two libcore versions from conflicting with each other. They are no longer necessary anymore as the libcore unit tests are now in a separate coretests package (and even before that got moved into a separate integration test crate years ago). |
9ad9f77
to
0b41057
Compare
So it sounds like we can get rid of them! I've identified all the other occurrences and removed them now. Since the PR description will be in the merge, I've updated it with some context. Are these mentioned issues relevant?
Lines 228 to 240 in 30f168e
|
These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
0b41057
to
638b226
Compare
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
A Cranelift patch needed to be regenerated |
There are some compiler tie-ins also gated behind |
Interestingly, some of those are in |
#[cfg(not(test))]
from core
impl blocks#[cfg(not(test))]
gates in core
The ones in libstd do still need to be gated as libstd has a fair amount of unit tests that aren't split into a separate package like is the case for libcore. I'm trying to move unit tests to integration tests for libstd too. |
Very nice. @bors r+ |
Rollup of 16 pull requests Successful merges: - rust-lang#133055 (Expand `CloneToUninit` documentation.) - rust-lang#137147 (Add exclude to config.toml) - rust-lang#137864 (Don't drop `Rvalue::WrapUnsafeBinder` during GVN) - rust-lang#137890 (doc: clarify that consume can be called after BufReader::peek) - rust-lang#137956 (Add RTN support to rustdoc) - rust-lang#137968 (Properly escape regexes in Python scripts) - rust-lang#138082 (Remove `#[cfg(not(test))]` gates in `core`) - rust-lang#138275 (expose `is_s390x_feature_detected!` from `std::arch`) - rust-lang#138303 (Fix Ptr inconsistency in {Rc,Arc}) - rust-lang#138309 (Add missing doc for intrinsic (Fix PR135334)) - rust-lang#138323 (Expand and organize `offset_of!` documentation.) - rust-lang#138329 (debug-assert that the size_hint is well-formed in `collect`) - rust-lang#138465 (linkchecker: bump html5ever) - rust-lang#138471 (Clean up some tests in tests/ui) - rust-lang#138472 (Add codegen test for rust-lang#129795) - rust-lang#138484 (Use lit span when suggesting suffix lit cast) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#138082 - thaliaarchi:slice-cfg-not-test, r=thomcc Remove `#[cfg(not(test))]` gates in `core` These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
I've now checked |
…thomcc Remove `#[cfg(not(test))]` gates in `core` These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
These gates are unnecessary now that unit tests for
core
are in a separate package,coretests
, instead of in the same files as the source code. They previously prevented the twocore
versions from conflicting with each other.