Skip to content

vectors don't handle zero-size elements correctly #7733

Closed
@thestinger

Description

@thestinger

Any usage of offset from the ptr module is likely wrong, because it uses size_of instead of nonzero_size_of. The iterators and slice implementations are two examples.

struct Foo;
let xs = ~[Foo, Foo, Foo];
println(fmt!("%?", xs.slice(0, 2).to_owned())) // prints `~[]`

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