Skip to content

Cannot compile std with atomics feature on wasm32-unknown-unknown target #86802

Closed
@tversteeg

Description

@tversteeg

I tried compiling an empty library, created with cargo init --lib, with the following flags:

RUSTFLAGS='-C target-feature=+atomics' cargo +nightly build --target wasm32-unknown-unknown -Z build-std=std
Cargo.toml
[package]
name = "wasm-test"
version = "0.1.0"
edition = "2018"

[lib]
crate-type = ["cdylib"]

[dependencies]

I expected it to compile properly. Instead, I got the following error:

error[E0252]: the name `unsupported` is defined multiple times
 --> /home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/wasm/atomics/thread.rs:5:5
  |
1 | use super::unsupported;
  |     ------------------ previous import of the value `unsupported` here
...
5 | use crate::sys::unsupported;
  |     ^^^^^^^^^^^^^^^^^^^^^^^ `unsupported` reimported here
  |
  = note: `unsupported` must be defined only once in the value namespace of this module
Full output
   Compiling compiler_builtins v0.1.46
   Compiling core v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.93
   Compiling cc v1.0.68
   Compiling dlmalloc v0.2.1
   Compiling std v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
   Compiling unwind v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
   Compiling rustc-std-workspace-core v1.99.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v0.1.10
   Compiling adler v0.2.3
   Compiling rustc-demangle v0.1.18
   Compiling rustc-std-workspace-alloc v1.99.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
   Compiling gimli v0.23.0
   Compiling std_detect v0.1.5 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
   Compiling miniz_oxide v0.4.0
   Compiling hashbrown v0.11.0
   Compiling object v0.22.0
   Compiling addr2line v0.14.0
error[E0252]: the name `unsupported` is defined multiple times
 --> /home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/wasm/atomics/thread.rs:5:5
  |
1 | use super::unsupported;
  |     ------------------ previous import of the value `unsupported` here
...
5 | use crate::sys::unsupported;
  |     ^^^^^^^^^^^^^^^^^^^^^^^ `unsupported` reimported here
  |
  = note: `unsupported` must be defined only once in the value namespace of this module

error: aborting due to previous error

For more information about this error, try `rustc --explain E0252`.
error: could not compile `std`

To learn more, run the command again with --verbose.

Meta

rustc +nightly --version --verbose:

rustc 1.55.0-nightly (7100b311d 2021-07-01)
binary: rustc
commit-hash: 7100b311df0367c4d9067687573d1396b22411df
commit-date: 2021-07-01
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions