-
Notifications
You must be signed in to change notification settings - Fork 353
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 error when replacing the default allocator with... the default allocator #2678
Comments
I think this is a duplicate of #2104. |
You are not replacing the default allocator with the default allocator, you are replacing it with the system allocator. That's not the same thing. :) On some platforms the default allocator used to be jemalloc. Not sure if that is still the case. On Miri, the default allocator is a special Miri-supplied allocator that can do more checking than would be possible if we directly forwarded to whatever std uses as default allocator on that platform. As a side-effect, this also fixes the aliasing trouble on Windows. |
Well... without MIRI, |
I don't think this is a guarantee -- AFAIK code which allocates via It is certainly a bug that |
To provide more context: it's not uncommon to have "middleware" allocators which wrap another allocator. For example, I have a crate In order to use |
Also, I think this backs up what I'm saying: https://doc.rust-lang.org/std/alloc/struct.System.html
|
I'm not disputing that setting I don't think there is a new bug here so I'll close this as a duplicate of #2104. I still feel like if you are not actually setting the global allocator, you better not rely on it actually being |
As for the docs you quoted, there are also other docs that say the exact opposite, so it's rather unclear what Miri should do... see rust-lang/wg-allocators#108. |
I have some code which passes MIRI. However, when I replace the default allocator with the
System
allocator, it gives a stacked borrows error:This implies something very weird is going on. None of my code is in the backtrace.
This is the full error:
As you can see, I'm running MIRI on windows.
The text was updated successfully, but these errors were encountered: