Skip to content

Mac and CI only failure in Bevy #4325

@NiklasEi

Description

@NiklasEi

We are having a strange Miri issue in Bevy. Our CI runs MIRIFLAGS="-Zmiri-ignore-leaks -Zmiri-disable-isolation" RUSTFLAGS="-Zrandomize-layout" cargo miri test -p bevy_ecs and using nightly-05-16 this fails with

Miri Failure from CLI (nightly-05-16)
cargo miri test -p bevy_ecs
shell: /bin/bash -e {0}
env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0
  CARGO_PROFILE_TEST_DEBUG: 0
  CARGO_PROFILE_DEV_DEBUG: 0
  NIGHTLY_TOOLCHAIN: nightly-2025-05-16
  RUSTFLAGS: -Zrandomize-layout
  BINSTALL_VERSION: v1.12.3
  CARGO_HOME: /Users/runner/.cargo
  MIRIFLAGS: -Zmiri-ignore-leaks -Zmiri-disable-isolation
Running `"rustup" "component" "add" "rust-src"` to install the `rust-src` component for the selected toolchain.
info: downloading component 'rust-src'
info: installing component 'rust-src'
Preparing a sysroot for Miri (target: aarch64-apple-darwin)... done
  Updating crates.io index
   Locking 784 packages to latest compatible versions
    Adding accesskit v0.18.0 (available: v0.19.0)
    Adding accesskit_winit v0.25.0 (available: v0.27.0)
    Adding codespan-reporting v0.11.1 (available: v0.12.0)
    Adding criterion v0.5.1 (available: v0.6.0)
    Adding derive_more v1.0.0 (available: v2.0.1)
    Adding encase v0.10.0 (available: v0.11.0)
    Adding encase_derive_impl v0.10.0 (available: v0.11.0)
    Adding getrandom v0.2.16 (available: v0.3.3)
    Adding glam v0.29.3 (available: v0.30.3)
    Adding hexasphere v15.1.0 (available: v16.0.0)
    Adding naga v24.0.0 (available: v25.0.1)
    Adding petgraph v0.7.1 (available: v0.8.1)
    Adding rand v0.8.5 (available: v0.9.1)
    Adding rand_chacha v0.3.1 (available: v0.9.0)
    Adding rand_distr v0.4.3 (available: v0.5.1)
    Adding ron v0.8.1 (available: v0.10.1)
    Adding smol_str v0.2.2 (available: v0.3.2)
    Adding taffy v0.7.7 (available: v0.8.1)
    Adding wgpu v24.0.3 (available: v25.0.0)
    Adding wgpu-types v24.0.0 (available: v25.0.0)
 Compiling bevy_platform v0.16.0-dev (/Users/runner/work/bevy/bevy/crates/bevy_platform)
 Compiling bevy_macro_utils v0.16.0-dev (/Users/runner/work/bevy/bevy/crates/bevy_macro_utils)
 Compiling bevy_ptr v0.16.0-dev (/Users/runner/work/bevy/bevy/crates/bevy_ptr)
error[E0463]: can't find crate for `foldhash`
--> crates/bevy_platform/src/hash.rs:12:9
 |
12 | pub use foldhash::fast::{FixedState, FoldHasher as DefaultHasher, RandomState};
 |         ^^^^^^^^ can't find crate

error[E0463]: can't find crate for `foldhash`
--> crates/bevy_platform/src/hash.rs:12:9
 |
12 | pub use foldhash::fast::{FixedState, FoldHasher as DefaultHasher, RandomState};
 |         ^^^^^^^^ can't find crate
 |
 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0463]: can't find crate for `hashbrown`
--> crates/bevy_platform/src/collections/mod.rs:8:9
|
8 | pub use hashbrown::Equivalent;
|         ^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `hashbrown`
--> crates/bevy_platform/src/collections/hash_map.rs:13:5
 |
13 | use hashbrown::{hash_map as hb, Equivalent};
 |     ^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `hashbrown`
--> crates/bevy_platform/src/collections/hash_map.rs:13:5
 |
13 | use hashbrown::{hash_map as hb, Equivalent};
 |     ^^^^^^^^^ can't find crate
 |
 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0463]: can't find crate for `hashbrown`
--> crates/bevy_platform/src/collections/hash_set.rs:16:5
 |
16 | use hashbrown::{hash_set as hb, Equivalent};
 |     ^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `hashbrown`
--> crates/bevy_platform/src/collections/hash_set.rs:16:5
 |
16 | use hashbrown::{hash_set as hb, Equivalent};
 |     ^^^^^^^^^ can't find crate
 |
 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0463]: can't find crate for `hashbrown`
--> crates/bevy_platform/src/collections/hash_table.rs:3:9
|
3 | pub use hashbrown::hash_table::{
|         ^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `hashbrown`
--> crates/bevy_platform/src/collections/hash_table.rs:3:9
|
3 | pub use hashbrown::hash_table::{
|         ^^^^^^^^^ can't find crate
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error[E0432]: unresolved imports `hash_table::HashTable`, `crate::hash::DefaultHasher`, `crate::hash::RandomState`, `hb::Drain`, `hb::IntoIter`, `hb::IntoKeys`, `hb::IntoValues`, `hb::Iter`, `hb::IterMut`, `hb::Keys`, `hb::OccupiedEntry`, `hb::VacantEntry`, `hb::Values`, `hb::ValuesMut`, `hb::EntryRef`, `hb::ExtractIf`, `hb::OccupiedError`, `hb::RawEntryBuilder`, `hb::RawEntryBuilderMut`, `hb::RawEntryMut`, `hb::RawOccupiedEntryMut`, `hb::Difference`, `hb::Drain`, `hb::Intersection`, `hb::IntoIter`, `hb::Iter`, `hb::SymmetricDifference`, `hb::Union`, `hb::ExtractIf`, `hb::OccupiedEntry`, `hb::VacantEntry`
--> crates/bevy_platform/src/collections/mod.rs:7:9
 |
7  | pub use hash_table::HashTable;
 |         ^^^^^^^^^^^^^^^^^^^^^
 |
::: crates/bevy_platform/src/collections/hash_map.rs:22:19
 |
22 |     crate::hash::{DefaultHasher, RandomState},
 |                   ^^^^^^^^^^^^^  ^^^^^^^^^^^
23 |     hb::{
24 |         Drain, IntoIter, IntoKeys, IntoValues, Iter, IterMut, Keys, OccupiedEntry, VacantEntry,
 |         ^^^^^  ^^^^^^^^  ^^^^^^^^  ^^^^^^^^^^  ^^^^  ^^^^^^^  ^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^^^
25 |         Values, ValuesMut,
 |         ^^^^^^  ^^^^^^^^^
...
31 |     EntryRef, ExtractIf, OccupiedError, RawEntryBuilder, RawEntryBuilderMut, RawEntryMut,
 |     ^^^^^^^^  ^^^^^^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^
32 |     RawOccupiedEntryMut,
 |     ^^^^^^^^^^^^^^^^^^^
 |
::: crates/bevy_platform/src/collections/hash_set.rs:24:14
 |
24 | pub use hb::{Difference, Drain, Intersection, IntoIter, Iter, SymmetricDifference, Union};
 |              ^^^^^^^^^^  ^^^^^  ^^^^^^^^^^^^  ^^^^^^^^  ^^^^  ^^^^^^^^^^^^^^^^^^^  ^^^^^
...
27 | pub use hb::{ExtractIf, OccupiedEntry, VacantEntry};
 |              ^^^^^^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^^^

error[E0460]: found possibly newer version of crate `std` which `serde` depends on
 --> crates/bevy_platform/src/collections/hash_map.rs:207:15
  |
207 | impl<K, V, S> serde::Serialize for HashMap<K, V, S>
  |               ^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `std`: /Users/runner/Library/Caches/org.rust-lang.miri/lib/rustlib/aarch64-apple-darwin/lib/libstd-00c91b87538a20fb.rmeta
          crate `serde`: /Users/runner/work/bevy/bevy/target/miri/aarch64-apple-darwin/debug/deps/libserde-02a5cd770eaacadd.rmeta

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_map.rs:209:27
  |
209 |     hb::HashMap<K, V, S>: serde::Serialize,
  |                           ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_map.rs:214:12
  |
214 |         T: serde::Serializer,
  |            ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_map.rs:221:20
  |
221 | impl<'de, K, V, S> serde::Deserialize<'de> for HashMap<K, V, S>
  |                    ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_map.rs:223:27
  |
223 |     hb::HashMap<K, V, S>: serde::Deserialize<'de>,
  |                           ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_map.rs:228:12
  |
228 |         D: serde::Deserializer<'de>,
  |            ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_map.rs:230:17
  |
230 |         Ok(Self(serde::Deserialize::deserialize(deserializer)?))
  |                 ^^^^^ can't find crate

error[E0463]: can't find crate for `hashbrown`
 --> crates/bevy_platform/src/collections/hash_map.rs:835:68
  |
835 |     pub fn try_reserve(&mut self, additional: usize) -> Result<(), hashbrown::TryReserveError> {
  |                                                                    ^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `hashbrown`
 --> crates/bevy_platform/src/collections/hash_set.rs:161:32
  |
161 |         Self(hb::HashSet::from(hashbrown::HashMap::from(value)))
  |                                ^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_set.rs:196:12
  |
196 | impl<T, S> serde::Serialize for HashSet<T, S>
  |            ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_set.rs:198:24
  |
198 |     hb::HashSet<T, S>: serde::Serialize,
  |                        ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_set.rs:203:12
  |
203 |         U: serde::Serializer,
  |            ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_set.rs:210:17
  |
210 | impl<'de, T, S> serde::Deserialize<'de> for HashSet<T, S>
  |                 ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_set.rs:212:24
  |
212 |     hb::HashSet<T, S>: serde::Deserialize<'de>,
  |                        ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_set.rs:217:12
  |
217 |         D: serde::Deserializer<'de>,
  |            ^^^^^ can't find crate

error[E0463]: can't find crate for `serde`
 --> crates/bevy_platform/src/collections/hash_set.rs:219:17
  |
219 |         Ok(Self(serde::Deserialize::deserialize(deserializer)?))
  |                 ^^^^^ can't find crate

error[E0463]: can't find crate for `hashbrown`
 --> crates/bevy_platform/src/collections/hash_set.rs:638:68
  |
638 |     pub fn try_reserve(&mut self, additional: usize) -> Result<(), hashbrown::TryReserveError> {
  |                                                                    ^^^^^^^^^ can't find crate

error[E0220]: associated type `Ok` not found for `T`
 --> crates/bevy_platform/src/collections/hash_map.rs:212:56
  |
212 |     fn serialize<T>(&self, serializer: T) -> Result<T::Ok, T::Error>
  |                                                        ^^ associated type `Ok` not found

error[E0220]: associated type `Error` not found for `T`
 --> crates/bevy_platform/src/collections/hash_map.rs:212:63
  |
212 |     fn serialize<T>(&self, serializer: T) -> Result<T::Ok, T::Error>
  |                                                               ^^^^^ associated type `Error` not found

error[E0220]: associated type `Error` not found for `D`
 --> crates/bevy_platform/src/collections/hash_map.rs:226:59
  |
226 |     fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
  |                                                           ^^^^^ associated type `Error` not found

error[E0220]: associated type `Ok` not found for `U`
 --> crates/bevy_platform/src/collections/hash_set.rs:201:56
  |
201 |     fn serialize<U>(&self, serializer: U) -> Result<U::Ok, U::Error>
  |                                                        ^^ associated type `Ok` not found

error[E0220]: associated type `Error` not found for `U`
 --> crates/bevy_platform/src/collections/hash_set.rs:201:63
  |
201 |     fn serialize<U>(&self, serializer: U) -> Result<U::Ok, U::Error>
  |                                                               ^^^^^ associated type `Error` not found

error[E0220]: associated type `Error` not found for `D`
 --> crates/bevy_platform/src/collections/hash_set.rs:215:59
  |
215 |     fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
  |                                                           ^^^^^ associated type `Error` not found

Some errors have detailed explanations: E0220, E0432, E0460, E0463.
For more information about an error, try `rustc --explain E0220`.
error: could not compile `bevy_platform` (lib) due to 44 previous errors
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

We cannot reproduce this error locally on macOS, Windows, or Ubuntu.
In GitHub CI it also works on ubuntu-latest and windows-latest.

CI is green for nightly-05-14 on macOS, so this looks like a newly introduced issue in Miri.

We cannot test on nightly-05-17, due to #4323 (different failure than the one described here).

What can we do to further understand this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions