Closed RalfJung closed 1 week ago
These files are from portable-simd, which means they are sometimes their own crate and sometimes a module imported into core
. There is indeed no as_crate
feature in core
, so no idea how these tests are passing in our CI.
Do we inject a -A unexpected_cfgs
somewhere for doctests, or something like that?
There's also one in std, from the backtrace module, which similarly is also sometimes a crate and sometimes a module:
0.000008 ---- library/std/src/../../backtrace/src/lib.rs - backtrace_rs (line 20) stdout ----
0.000007 error: unexpected `cfg` condition value: `std`
0.000007 --> library/std/src/../../backtrace/src/lib.rs:23:7
0.000008 |
0.000007 5 | #[cfg(feature = "std")] {
0.000008 | ^^^^^^^^^^^^^^^
0.000007 |
0.000008 = note: expected values for `feature` are: `addr2line`, `backtrace`, `compiler-builtins-c`, `compiler-builtins-mangled-names`, `compiler-builtins-mem`, `compiler-builtins-no-asm`, `compiler-builtins-weak-intrinsics`, `llvm-libunwind`, `miniz_oxide`, `object`, `panic-unwind`, `panic_immediate_abort`, `panic_unwind`, `profiler`, `profiler_builtins`, `std_detect_dlsym_getauxval`, `std_detect_env_override`, `std_detect_file_io`, `system-llvm-libunwind`
0.000008 = help: consider adding `std` as a feature in `Cargo.toml`
0.000007 = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration
0.000007 note: the lint level is defined here
0.000007 --> library/std/src/../../backtrace/src/lib.rs:19:9
0.000007 |
0.000007 1 | #![deny(warnings)]
0.000007 | ^^^^^^^^
0.000007 = note: `#[deny(unexpected_cfgs)]` implied by `#[deny(warnings)]`
0.000008
0.000007 error: aborting due to 1 previous error
0.000007
0.000007 Couldn't compile the test.
Huh.
It's quite possible that this is caused by the CI mess. One of the insta-merged PRs was a miri sync.
It's possible but seems unlikely to me. I guess we'll have to see.
Interestingly, the in-tree test suite is working, so there's likely some special bootstrap magic somewhere that out-of-tree tests do not benefit from?
Yes, there is, https://github.com/rust-lang/rust/blob/69ffc0d3a3c619009bcb27b8f61d810e27b12612/src/bootstrap/src/core/builder.rs#L1545-L1555
I would suggest doing the same and adding as part of the build --check-cfg=cfg(feature,values(any()))
, possibly in RUSTFLAGS
or somewhere else.
That seems to help, thanks. :)
Another thing we could do now that check-cfg
is stable, is adding this exception directly in the build.rs
of core
, alloc
and std
with the Cargo instruction cargo::rustc-check-cfg
.
If you end up doing that, please ping me so I can revert https://github.com/rust-lang/miri-test-libstd/pull/66.
@RalfJung I don't think allowing all values for the feature
cfg is going to be enough. There are many other custom cfgs used in core
/alloc
/std
, https://github.com/rust-lang/rust/blob/69ffc0d3a3c619009bcb27b8f61d810e27b12612/src/bootstrap/src/lib.rs#L87-L97
In fact I can see them in the latest CI run under the "Setup environment". If you want to completely silence them, allowing the lint (-Aunexpected_cfgs
in RUSTFLAGS
) is probably (in the short term) the best course of action.
This was enough though to make the tests pass again... :shrug:
Oh, they are shown as warning, not hard errors.
Sure, I can also allow the lint entirely.
Actually, those warnings come from the sysroot build, not the local test build. So this will need a patch in https://github.com/RalfJung/rustc-build-sysroot/ . Also, -Aunexpected_cfgs
does not help for the doctests, for some reason.
(FWIW, debugging rustc invocations became a lot harder when they all grew to more than twice their size due to all these --check-cfg
flags. If there's any way to hide these flags e.g. in argument files or so, that would be great...)
Running std doctests in Miri results in tons of errors since today's nightly:
Interestingly, the in-tree test suite is working, so there's likely some special bootstrap magic somewhere that out-of-tree tests do not benefit from?
cc @Urgau