Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thestinger opened this issue Jul 12, 2013 · 0 comments
Closed

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

thestinger opened this issue Jul 12, 2013 · 0 comments

Comments

@thestinger
Copy link
Contributor

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 `~[]`
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jul 12, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 28, 2021
Rustup

This needs a review this time. Especially rust-lang/rust-clippy@521bf8f cc `@camsteffen` I think this is necessary now, because `itertools` is no longer a dependency of `clippy_utils` and therefore this path can't be found 🤔

( I forgot about the sync last week. I should get to document this process better, so other people can do it when I'm not around )

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant