-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
std: Remove internal definitions of cfg_if!
macro
#61720
Conversation
r? @bluss (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -336,6 +336,9 @@ extern crate libc; | |||
#[allow(unused_extern_crates)] | |||
extern crate unwind; | |||
|
|||
#[macro_use] | |||
extern crate cfg_if; |
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.
Note that this is here because there's usage of a bare cfg_if!
macro invocation in stdsimd
. That needs to be updated to cfg_if::cfg_if!
before this can be removed, but that can hopefully happen in parallel with this.
aa2766e
to
9502d29
Compare
r? @sfackler |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
9502d29
to
8eb7f36
Compare
@bors r+ |
📌 Commit 8eb7f36 has been approved by |
…fackler std: Remove internal definitions of `cfg_if!` macro This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
…fackler std: Remove internal definitions of `cfg_if!` macro This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
…fackler std: Remove internal definitions of `cfg_if!` macro This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
Rollup of 5 pull requests Successful merges: - #61598 (Handle index out of bound errors during const eval without panic) - #61720 (std: Remove internal definitions of `cfg_if!` macro) - #61757 (Deprecate ONCE_INIT in future 1.38 release) - #61766 (submodules: update clippy from c0dbd34 to bd33a97) - #61791 (Small cleanup in `check_pat_path`) Failed merges: r? @ghost
@alexcrichton any idea why this might break building libstd with xargo?
|
@@ -15,6 +15,7 @@ crate-type = ["dylib", "rlib"] | |||
|
|||
[dependencies] | |||
alloc = { path = "../liballoc" } | |||
cfg-if = "0.1.8" |
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.
Shouldn't this enable the rustc-dep-of-std
feature?
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.
Hm, that leads to a build failure?!?
error: failed to select a version for `cfg-if`.
... required by package `std v0.0.0 (/home/r/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd)`
... which is depended on by `sysroot v0.0.0 (/tmp/xargo.NWDhLbN6RoeP)`
versions that meet the requirements `^0.1.9` are: 0.1.9
the package `std` depends on `cfg-if`, with features: `rustc-dep-of-std` but `cfg-if` does not have these features.
failed to select a version for `cfg-if` which could resolve this conflict
But the feature is present since rust-lang/cfg-if@3e31141.
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.
Looks like the crates.io version differs from the GH version in that parts of the toml are commented out...??
# [dependencies]
# core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }
# compiler_builtins = { version = '0.1.2', optional = true }
#
# [features]
# rustc-dep-of-std = ['core', 'compiler_builtins']
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.
Reported as rust-lang/cfg-if#22.
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.
And submitted hopefully fixing PR as #61828.
make sure we use cfg-if as a std dependency xargo currently fails to build libstd because this feature is missing. My guess is that it works in rustc because the feature is enabled elsewhere, but that does not help for a libstd-only build. Miri is currently in a state where it is shipped but broken, which makes CI fail for projects that are tested in Miri. So this is kind of urgent. Cc @alexcrichton #61720
This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the
cfg-if
crate on crates.io, allowing us to use itfrom there!