Skip to content

driftsort implementation uses an out-of-range literal on 16-bit targets #129910

Closed
@saethlin

Description

Run

cargo +nightly miri setup --target avr-unknown-gnu-atmega328

Or

x check library/core --target avr-unknown-gnu-atmega328

And you'll get this diagnostic (cargo miri setup makes it a warning, lol):

error: literal out of range for `usize`
  --> core/src/slice/sort/stable/mod.rs:62:41
   |
62 |     const MAX_FULL_ALLOC_BYTES: usize = 8_000_000; // 8MB
   |                                         ^^^^^^^^^
   |
   = note: the literal `8_000_000` does not fit into the type `usize` whose range is `0..=65535`
   = note: `#[deny(overflowing_literals)]` on by default

I don't know what effect this has at runtime but it can't be good.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-AVRTarget: AVR processors (ATtiny, ATmega, etc.)O-msp430T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions