Skip to content

Failing to build on certain embedded platforms #2400

Closed
@joshlf

Description

@joshlf

Progress

  • Fix build failures: Support 16-bit target platforms #2401
  • Add a regression test
    • Note that this is blocked on being able to roll our pinned nightly toolchain in order to bring in this upstream commit
    • The relevant build command is: RUSTFLAGS='-C target-cpu=atmega328p' cargo +nightly-2025-02-25 check --target=avr-none -Zbuild-std=core

Originally reported by @ErickTorresBrownU in rust-random/rand#1574 (comment):

For instance, I can no longer compile my embedded Rust code because rand/rand_core now depends on zerocopy.

error[E0080]: evaluation of constant value failed
   --> C:\Users\erick\.cargo\registry\src\index.crates.io-6f17d22bba15001f\zerocopy-0.8.20\src\layout.rs:120:80
    |
120 |     pub(crate) const CURRENT_MAX_ALIGN: NonZeroUsize = match NonZeroUsize::new(1 << 28) {
    |                                                                                ^^^^^^^ attempt to shift left by `28_i32`, which would overflow

@ErickTorresBrownU, what platform are you building for here? We would like to support this use case and add this platform to our CI so we don't regress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions