Skip to content

unreachable pub item from portable-simd with target_feature = "avx512f" #138054

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

Open
12101111 opened this issue Mar 5, 2025 · 8 comments
Open
Labels
A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. C-bug Category: This is a bug. P-low Low priority PG-portable-simd Project group: Portable SIMD (https://github.com/rust-lang/project-portable-simd) regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@12101111
Copy link
Contributor

12101111 commented Mar 5, 2025

Summary

Can't build core with target_feature = "avx512f"

#[cfg_attr(
not(all(target_arch = "x86_64", target_feature = "avx512f")),
path = "masks/full_masks.rs"
)]
#[cfg_attr(
all(target_arch = "x86_64", target_feature = "avx512f"),
path = "masks/bitmask.rs"
)]
mod mask_impl;

Command used

export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS=-Ctarget-cpu=znver4 -Clinker=clang -Clink-arg=-fuse-ld=lld -Ctarget-feature=-crt-static
./x build

Expected behaviour

It should build

Actual behaviour

Multiple errors about unreachable pub item

Bootstrap configuration (config.toml)

[llvm]
download-ci-llvm = false
link-shared = true
use-libcxx = true
[build]
build = "x86_64-unknown-linux-musl"
verbose = 1
[install]
[rust]
default-linker = "clang"
[target.x86_64-unknown-linux-musl]
ar = "llvm-ar"
cc = "clang"
cxx = "clang++"
linker = "clang"
ranlib = "llvm-ranlib"
llvm-libunwind = "system"
llvm-config = "/usr/lib/llvm/19/bin/llvm-config"
crt-static = false
musl-root = "/usr"
[dist]

Operating system

Gentoo Linux amd64 (musl-llvm profile)

HEAD

Additional context

Build Log

error: unreachable `pub` item
 --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:8:1
  |
8 | pub struct Mask<T, const N: usize>(
  | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  | |
  | help: consider restricting its visibility: `pub(super)`
  |
  = help: or consider exporting it for use by other crates
  = note: `-D unreachable-pub` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unreachable_pub)]`

error: unreachable `pub` item
  --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:81:5
   |
81 |     pub fn splat(value: bool) -> Self {
   |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
  --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:96:5
   |
96 |     pub unsafe fn test_unchecked(&self, lane: usize) -> bool {
   |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:101:5
    |
101 |     pub unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
    |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:109:5
    |
109 |     pub fn to_int(self) -> Simd<T, N> {
    |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:121:5
    |
121 |     pub unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
    |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:126:5
    |
126 |     pub fn to_bitmask_integer(self) -> u64 {
    |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:133:5
    |
133 |     pub fn from_bitmask_integer(bitmask: u64) -> Self {
    |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:144:5
    |
144 |       pub fn convert<U>(self) -> Mask<U, N>
    |       ^--
    |       |
    |  _____help: consider restricting its visibility: `pub(super)`
    | |
145 | |     where
146 | |         U: MaskElement,
    | |_______________________^

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:154:5
    |
154 |     pub fn any(self) -> bool {
    |     ---^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(super)`

error: unreachable `pub` item
   --> library/core/src/../../portable-simd/crates/core_simd/src/masks/bitmask.rs:160:5
    |
160 |     pub fn all(self) -> bool {
    |     ---^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(super)`

    Building [=====>                      ] 8/34: core
Did not run successfully: exit status: 1
LD_LIBRARY_PATH="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/lib:/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std/release/deps" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/rustc" "--crate-name" "core" "--edition=2021" "library/core/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--diagnostic-width=147" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "--warn=unexpected_cfgs" "--check-cfg" "cfg(bootstrap)" "--check-cfg" "cfg(no_fp_fmt_parse)" "--check-cfg" "cfg(stdarch_intel_sde)" "--check-cfg" "cfg(feature, values(any()))" "--check-cfg" "cfg(docsrs,test)" "--check-cfg" "cfg(feature, values(\"debug_refcell\", \"debug_typeid\", \"optimize_for_size\", \"panic_immediate_abort\"))" "-C" "metadata=8f1374cf7fcb7396" "-C" "extra-filename=-e24e7bfa0bd6d9f5" "--out-dir" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std/x86_64-unknown-linux-musl/release/deps" "--target" "x86_64-unknown-linux-musl" "-C" "linker=clang" "-L" "dependency=/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std/x86_64-unknown-linux-musl/release/deps" "-L" "dependency=/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std/release/deps" "-Ctarget-cpu=znver4" "-Clinker=clang" "-Clink-arg=-fuse-ld=lld" "-Ctarget-feature=-crt-static" "--cfg=bootstrap" "-Csymbol-mangling-version=legacy" "--check-cfg=cfg(feature,values(any()))" "-Zunstable-options" "--check-cfg=cfg(bootstrap)" "-Zmacro-backtrace" "-Csplit-debuginfo=off" "-Ctarget-feature=-crt-static" "-Cprefer-dynamic" "-Zinline-mir" "-Zinline-mir-preserve-debug" "-Zmir_strip_debuginfo=locals-in-tiny-functions" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Alinker-messages" "-L" "native=/usr/lib" "-Cforce-frame-pointers=yes" "-Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" "-Z" "binary-dep-depinfo" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Dwarnings" "--sysroot" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-sysroot" "-Z" "force-unstable-if-unmarked"
-------------
error: could not compile `core` (lib) due to 11 previous errors

Caused by:
  process didn't exit successfully: `/home/han/Project/rust/build/bootstrap/debug/rustc /home/han/Project/rust/build/bootstrap/debug/rustc --crate-name core --edition=2021 library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=147 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --warn=unexpected_cfgs --check-cfg 'cfg(bootstrap)' --check-cfg 'cfg(no_fp_fmt_parse)' --check-cfg 'cfg(stdarch_intel_sde)' --check-cfg 'cfg(feature, values(any()))' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("debug_refcell", "debug_typeid", "optimize_for_size", "panic_immediate_abort"))' -C metadata=8f1374cf7fcb7396 -C extra-filename=-e24e7bfa0bd6d9f5 --out-dir /home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std/x86_64-unknown-linux-musl/release/deps --target x86_64-unknown-linux-musl -C linker=clang -L dependency=/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std/x86_64-unknown-linux-musl/release/deps -L dependency=/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std/release/deps -Ctarget-cpu=znver4 -Clinker=clang -Clink-arg=-fuse-ld=lld -Ctarget-feature=-crt-static --cfg=bootstrap -Csymbol-mangling-version=legacy '--check-cfg=cfg(feature,values(any()))' -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Ctarget-feature=-crt-static -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -L native=/usr/lib -Cforce-frame-pointers=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo` (exit status: 1)
command did not execute successfully: cd "/home/han/Project/rust" && env -u MAKEFLAGS -u MFLAGS AR_x86_64_unknown_linux_musl="llvm-ar" CARGO_INCREMENTAL="0" CARGO_LOG="cargo::core::compiler::fingerprint=info" CARGO_PROFILE_RELEASE_DEBUG="0" CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS="false" CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS="false" CARGO_PROFILE_RELEASE_STRIP="false" CARGO_TARGET_DIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-std" CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER="clang" CC_x86_64_unknown_linux_musl="clang" CFG_COMPILER_BUILD_TRIPLE="x86_64-unknown-linux-musl" CFG_COMPILER_HOST_TRIPLE="x86_64-unknown-linux-musl" CFG_RELEASE_CHANNEL="dev" CFLAGS_x86_64_unknown_linux_musl="" CXXFLAGS_x86_64_unknown_linux_musl="" CXX_x86_64_unknown_linux_musl="clang++" LIBC_CHECK_CFG="1" RANLIB_x86_64_unknown_linux_musl="llvm-ar s" REAL_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" RUSTBUILD_NATIVE_DIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/native" RUSTC="/home/han/Project/rust/build/bootstrap/debug/rustc" RUSTC_BOOTSTRAP="1" RUSTC_BREAK_ON_ICE="1" RUSTC_ERROR_METADATA_DST="/home/han/Project/rust/build/tmp/extended-error-metadata" RUSTC_FORCE_UNSTABLE="1" RUSTC_HOST_FLAGS="--cfg=bootstrap -Zunstable-options --check-cfg=cfg(bootstrap) -Ctarget-feature=-crt-static -Clinker=clang" RUSTC_INSTALL_BINDIR="bin" RUSTC_LIBDIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/lib" RUSTC_LINK_STD_INTO_RUSTC_DRIVER="1" RUSTC_LINT_FLAGS="-Wrust_2018_idioms -Wunused_lifetimes -Dwarnings" RUSTC_REAL="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/rustc" RUSTC_SNAPSHOT="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/rustc" RUSTC_SNAPSHOT_LIBDIR="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/lib" RUSTC_STAGE="0" RUSTC_SYSROOT="/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0-sysroot" RUSTC_VERBOSE="1" RUSTC_WRAPPER="/home/han/Project/rust/build/bootstrap/debug/rustc" RUSTDOC="/home/han/Project/rust/build/bootstrap/debug/rustdoc" RUSTDOCFLAGS="-Ctarget-cpu=znver4 -Clinker=clang -Clink-arg=-fuse-ld=lld -Ctarget-feature=-crt-static --cfg=bootstrap -Csymbol-mangling-version=legacy --check-cfg=cfg(feature,values(any())) -Zunstable-options --check-cfg=cfg(bootstrap) -Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.87.0-dev -Clinker=clang -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\") -Zcrate-attr=warn(rust_2018_idioms)" RUSTDOC_REAL="/path/to/nowhere/rustdoc/not/required" RUSTFLAGS="-Ctarget-cpu=znver4 -Clinker=clang -Clink-arg=-fuse-ld=lld -Ctarget-feature=-crt-static --cfg=bootstrap -Csymbol-mangling-version=legacy --check-cfg=cfg(feature,values(any())) -Zunstable-options --check-cfg=cfg(bootstrap) -Zmacro-backtrace -Csplit-debuginfo=off -Ctarget-feature=-crt-static -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin -Clink-args=-Wl,-rpath,$ORIGIN/../lib -Alinker-messages -L native=/usr/lib -Cforce-frame-pointers=yes -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" RUST_TEST_THREADS="32" WINAPI_NO_BUNDLED_LIBRARIES="1" __CARGO_DEFAULT_LIB_METADATA="bootstrapstd1.87.0" "/home/han/Project/rust/build/x86_64-unknown-linux-musl/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-musl" "-Zbinary-dep-depinfo" "-j" "32" "-Zroot-dir=/home/han/Project/rust" "-v" "--release" "--features" "backtrace panic-unwind system-llvm-libunwind" "--manifest-path" "/home/han/Project/rust/library/sysroot/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
Traceback (most recent call last):
  File "/home/han/Project/rust/x.py", line 53, in <module>
    bootstrap.main()
  File "/home/han/Project/rust/src/bootstrap/bootstrap.py", line 1339, in main
    bootstrap(args)
  File "/home/han/Project/rust/src/bootstrap/bootstrap.py", line 1314, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/home/han/Project/rust/src/bootstrap/bootstrap.py", line 236, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /home/han/Project/rust/build/bootstrap/debug/bootstrap build

@12101111 12101111 added C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 5, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 5, 2025
@onur-ozkan onur-ozkan added O-musl Target: The musl libc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 5, 2025
@FireBurn
Copy link

FireBurn commented Mar 5, 2025

It's happening with glibc too. Dropping "-C target-cpu=native" gets things going again

@Urgau
Copy link
Member

Urgau commented Mar 6, 2025

Since #134286 we enabled the unreachable_pub lint in core, but our CI is not testing building core with special target feature enhance the failure in those non standard configuration.

@calebzulawski @workingjubilee what would be the best way forward? Fix in portable-simd with subtree sync? Allow in core for the moment?

@Urgau Urgau added T-libs Relevant to the library team, which will review and decide on the PR/issue. PG-portable-simd Project group: Portable SIMD (https://github.com/rust-lang/project-portable-simd) A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) O-musl Target: The musl libc labels Mar 6, 2025
@calebzulawski
Copy link
Member

Subtree sync is probably easiest. @workingjubilee should we even bother with the avx512 mask layout for now? The regular masks still codegen to k registers as long as they don't go to memory

@Urgau
Copy link
Member

Urgau commented Mar 16, 2025

Any input on the previous message @workingjubilee?

Urgau added a commit to Urgau/portable-simd that referenced this issue Mar 17, 2025
Urgau added a commit to Urgau/portable-simd that referenced this issue Mar 17, 2025
@Urgau Urgau added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Mar 18, 2025
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 18, 2025
@apiraino
Copy link
Contributor

Assigning priority (discussion on Zulip).

@rustbot label -I-prioritize +P-low

@rustbot rustbot added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 19, 2025
@Urgau
Copy link
Member

Urgau commented Mar 20, 2025

Fixed with #138687

@Amanieu
Copy link
Member

Amanieu commented Mar 26, 2025

#138687 is merged, is this now resolved?

@Urgau
Copy link
Member

Urgau commented Mar 26, 2025

It's technically a stable to beta regression and #138687 is only in master/was not backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. C-bug Category: This is a bug. P-low Low priority PG-portable-simd Project group: Portable SIMD (https://github.com/rust-lang/project-portable-simd) regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants