alloc: stabilise Allocator#156882
Open
nia-e wants to merge 1 commit into
Open
Conversation
Member
Author
|
r? @Amanieu |
This comment has been minimized.
This comment has been minimized.
CAD97
reviewed
May 24, 2026
| /// let heap : BinaryHeap<i32, System> = BinaryHeap::new_in(System); | ||
| /// ``` | ||
| #[unstable(feature = "allocator_api", issue = "32838")] | ||
| #[rustc_const_unstable(feature = "allocator_api", issue = "32838")] |
Member
There was a problem hiding this comment.
isn't this implied by #[unstable]?
fmease
reviewed
May 24, 2026
Comment on lines
+394
to
+397
| /// Dummy function. Used to make `Allocator` non-`dyn` compatible for now. | ||
| #[doc(hidden)] | ||
| #[unstable(feature = "allocator_api", issue = "32838")] | ||
| fn dummy_no_dyn() {} |
Member
There was a problem hiding this comment.
Instead, you could add #[rustc_dyn_incompatible_trait] to the trait. That would also improve diagnostics.
Member
Author
There was a problem hiding this comment.
yeah that's a pure brain fart on my end :D ty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stabilise a bare-minimum (dyn-incompatible, but could be in the future)
Allocatortrait, alongsideBox::new_in(),Vec::new_in(), theSystemAllocatorimpl, and a blanket impl ofAllocator for T: GlobalAlloc. For now, we should take care not to make it possible to instantiate anything other than aVecorBoxwith custom allocators; it's Probably Fine, but worth a proper look before we rush in.The soundness requirements for implementors were tightened to the most restrictive ones we could reasonably want per a conversation with @RalfJung.
This was discussed extensively at the all-hands with an apparent tenative consensus from libs and participating ecosystem stakeholders that the current design can be extended backwards-compatibly to address almost all usecases.
cc @rust-lang/libs @rust-lang/libs-api @rust-lang/opsem
r? libs