-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
BTreeMap::iter_mut asserts on coarsely aligned keys #67438
Labels
A-collections
Area: `std::collection`
C-bug
Category: This is a bug.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Comments
Centril
added
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
C-bug
Category: This is a bug.
A-collections
Area: `std::collection`
labels
Dec 21, 2019
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Dec 26, 2019
prune ill-conceived BTreeMap iter_mut assertion and test its mutability Proposal to deal with rust-lang#67438 (and I'm more sure now that this is the right thing to do). Passes testing with miri.
bors
added a commit
that referenced
this issue
Dec 28, 2019
prune ill-conceived BTreeMap iter_mut assertion and test its mutability Proposal to deal with #67438 (and I'm more sure now that this is the right thing to do). Passes testing with miri.
Rust Playground example is fixed in nightly, I think I can close this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-collections
Area: `std::collection`
C-bug
Category: This is a bug.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
thread 'main' panicked at 'assertion failed: mem::size_of::<NodeHeader<K, V>>() == mem::size_of::<NodeHeader<K, V, K>>()', src\liballoc\collections\btree\node.rs:612:13
is the result of this code on playground and elsewhere:There is no problem with ordinary u64 or u128 keys (both have 8 byte alignment on x86), neither on 32-bit nor 64-bit builds.
Removing the assert (or relaxing the
==
to<=
, which then states the obvious) makes everything pass, including testing with miri and including some more tests I wrote.Whether that's the right solution, I can't tell, because I've been trying in vain to understand the changes to the
into_key_slice
function in #56648. All that is clear to me is that the comment "because we did the alignment check above" is misguided and I think this issue proves that. For your entertainment, here are some particular asserts that also succeed on x86_64-unknown-linux-gnu, x86_64-pc-windows-msvc and i686-pc-windows-msvc:The text was updated successfully, but these errors were encountered: