Skip to content

Zero sized DST struct item causes invalid free #23491

Closed
@talchas

Description

@talchas
struct Node<T: ?Sized>(T);

fn main() {
   let x: Box<Node<[isize]>> = box Node([]);
}

seems to result in a call to foo::heap::exchange_free(1, 0, 1) in the drop glue (and no allocates), which results in a crash. Just doing Box<[isize]> works, as do non-empty input arrays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions