Skip to content

try_reserve tests execute UB, will fail in Rust 1.82 #34

Closed
@saethlin

Description

@saethlin

I am filing this issue because this project's tests failed in the crater runs for Rust 1.82: rust-lang/rust#130579, you can reproduce this failure with cargo +beta test or cargo +nightly test.

There is some interesting wording in the failing test:

minivec/tests/vec.rs

Lines 1600 to 1603 in 7573a54

// On 16/32-bit, we check that allocations don't exceed isize::MAX,
// on 64-bit, we assume the OS will give an OOM for such a ridiculous size.
// Any platform that succeeds for these requests is technically broken with
// ptr::offset because LLVM is the worst.

You cannot rely on the underlying allocator to fail in this scenario. Even if the allocator does fail, the execution encounters UB before the abort due to allocation failure, so it is technically wrong to rely on the allocator failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions