Skip to content

Conversation

@smaeul
Copy link
Contributor

@smaeul smaeul commented Nov 15, 2025

These hashbrown features are intended to be used only when building that library as part of std from inside the rustc workspace. Normally, if these features are enabled outside of a compiler build, the crates.io versions of rustc-std-workspace-core and rustc-std-workspace-alloc harmlessly wrap the core and alloc crates from the compiler's sysroot. But when using -Zbuild-std, they create a second conflicting copy of core and alloc inside the local workspace:

$ cargo build --no-default-features -Z build-std=core,alloc
   Compiling hashbrown v0.15.5
error[E0464]: multiple candidates for `rmeta` dependency `core` found
  |
  = note: candidate #1: mqtt-protocol-core/target/debug/deps/libcore-63212f86292bc9b2.rmeta
  = note: candidate #2: mqtt-protocol-core/target/debug/deps/librustc_std_workspace_core-87d6eaf43c4c124e.rmeta

error[E0464]: multiple candidates for `rmeta` dependency `alloc` found
  --> hashbrown-0.15.5/src/lib.rs:64:1
   |
64 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^
   |
   = note: candidate #1: mqtt-protocol-core/target/debug/deps/liballoc-72d6465b9ee82117.rmeta
   = note: candidate #2: mqtt-protocol-core/target/debug/deps/librustc_std_workspace_alloc-a3fbb36e3ffcf55c.rmeta

These hashbrown features are intended to be used only when building that
library as part of `std` from inside the rustc workspace. Normally, if
these features are enabled outside of a compiler build, the crates.io
versions of `rustc-std-workspace-core` and `rustc-std-workspace-alloc`
harmlessly wrap the `core` and `alloc` crates from the compiler's
sysroot. But when using `-Zbuild-std`, they create a second conflicting
copy of `core` and `alloc` inside the local workspace:

```
$ cargo build --no-default-features -Z build-std=core,alloc
   Compiling hashbrown v0.15.5
error[E0464]: multiple candidates for `rmeta` dependency `core` found
  |
  = note: candidate redboltz#1: mqtt-protocol-core/target/debug/deps/libcore-63212f86292bc9b2.rmeta
  = note: candidate redboltz#2: mqtt-protocol-core/target/debug/deps/librustc_std_workspace_core-87d6eaf43c4c124e.rmeta

error[E0464]: multiple candidates for `rmeta` dependency `alloc` found
  --> hashbrown-0.15.5/src/lib.rs:64:1
   |
64 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^
   |
   = note: candidate redboltz#1: mqtt-protocol-core/target/debug/deps/liballoc-72d6465b9ee82117.rmeta
   = note: candidate redboltz#2: mqtt-protocol-core/target/debug/deps/librustc_std_workspace_alloc-a3fbb36e3ffcf55c.rmeta
```
@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.90%. Comparing base (bffb834) to head (eb05f65).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #47      +/-   ##
==========================================
- Coverage   90.91%   90.90%   -0.01%     
==========================================
  Files          55       55              
  Lines        7459     7456       -3     
==========================================
- Hits         6781     6778       -3     
  Misses        678      678              

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@redboltz
Copy link
Owner

@smaeul , thank you for sending the PR. It looks good to me.

@redboltz redboltz merged commit 3db1dd3 into redboltz:main Nov 16, 2025
10 checks passed
@smaeul smaeul deleted the up/no-std-build branch November 16, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants