-
Notifications
You must be signed in to change notification settings - Fork 361
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
Stacked Borrows violation when using bumpalo::boxed::Box
instead of std::box::Box
#2704
Comments
Neither. This is #2528, the previous behavior of Miri was a false negative. You can reproduce the old behavior with The issue here is that The bug in |
If this were a bug in the implementation of Edit: Oh wait, are we supposed to use |
Which error? This seems to be actually unrelated to #2104 if that's what you mean. |
Miri doesn't complain because the standard library |
Sorry got a little bit confused with the different methods. You're right, there is no error with |
Also closing this now because this is more of a bumpalo issue than a miri issue. |
Miri now reports UB with some uses of bumpalo's Box where it did not before: rust-lang/miri#2704 The previous behavior of Miri was a false negative. rustc applies noalias to newtype wrappers around &mut, so Miri has to retag &mut when passed by value to a function even if it is in a wrapper struct, such as bumpalo's Box. mem::forget is a common aliasing footgun, because for a unique-owning wrapper like Box, leaking an RAII handle re-asserts the uniqueness of the handle as it is sent to the void. Ouch. ManuallyDrop solves this problem.
Miri now reports UB with some uses of bumpalo's Box where it did not before: rust-lang/miri#2704 The previous behavior of Miri was a false negative. rustc applies noalias to newtype wrappers around &mut, so Miri has to retag &mut when passed by value to a function even if it is in a wrapper struct, such as bumpalo's Box. mem::forget is a common aliasing footgun, because for a unique-owning wrapper like Box, leaking an RAII handle re-asserts the uniqueness of the handle as it is sent to the void. Ouch. ManuallyDrop solves this problem.
I have already opened an issue on bumpalo's side here: fitzgen/bumpalo#187
However, I am not sure if this is a bumpalo issue or a miri issue so opening here as well.
The following code doesn't run with miri's Stacked Borrows:
But if all instances of
BumpBox
are replaced with theBox
fromstd
, miri no longer complains.Error:
I am not sure if this is a false-positive from miri or a regression from bumpalo but the error is there with the following versions of
bumpalo
and miri:bumpalo
:3.5.0
and3.11.1
(have tested both)There was no error with previous versions of miri and same code.
This also errors when using the allocator api on nightly.
Possibly related to #2104
The text was updated successfully, but these errors were encountered: