Skip to content

Support for core::mem::forget_unsized #2872

@Jules-Bertholet

Description

@Jules-Bertholet
#![feature(forget_unsized, unsized_fn_params)]

fn main() {
    let b: Box<[u32]> = Box::new([1, 2, 3]);
    std::mem::forget_unsized(*b);
}

Miri fails to run the above program with the following error:

error: unsupported operation: unsized locals are not supported
   --> /home/julesbertholet/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:159:24
    |
159 |     intrinsics::forget(t)
    |                        ^ unsized locals are not supported
    |
    = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
    = note: BACKTRACE:
    = note: inside `std::mem::forget_unsized::<[u32]>`

There are no unsized locals in this program, so at the very least, the error message is incorrect.

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