Repository navigation
Unstably implement StaticAllocator on fundamental types - #166221
Merged
rust-bors[bot] merged 1 commit intoNov 23, 2026
Merged
rust-bors[bot] merged 1 commit into
rust-bors[bot] merged 1 commit into
Conversation
maxdexh
commented
Nov 19, 2026
| /// | ||
| /// This trait impl is unstable and only usable on nightly with `feature(allocator_ext)`. | ||
| /// It may be changed or removed in the future. | ||
| // FIXME: We may want to weaken the `Allocator` bound here to some `PinnedAllocator` |
Member
Author
There was a problem hiding this comment.
Also added this fixme here because we discussed this on zulip at some point and will probably forget it.
This comment was marked as resolved.
This comment was marked as resolved.
maxdexh
force-pushed
the
reserve-fundamental-static-alloc-impls
branch
from
November 19, 2026 19:37
c359b94 to
d0b06ce
Compare
maxdexh
force-pushed
the
reserve-fundamental-static-alloc-impls
branch
from
November 19, 2026 19:39
d0b06ce to
80ed9e0
Compare
This comment has been minimized.
This comment has been minimized.
maxdexh
force-pushed
the
reserve-fundamental-static-alloc-impls
branch
2 times, most recently
from
November 19, 2026 19:53
6e73623 to
ae0b40a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
maxdexh
force-pushed
the
reserve-fundamental-static-alloc-impls
branch
from
November 19, 2026 20:45
ae0b40a to
4046033
Compare
Contributor
|
Yeah, okay. @bors r+ rollup |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 23, 2026
Rollup of 5 pull requests Successful merges: - #164537 (Parser: Clean up `parse_expr_dot_or_call_with` & simplify `parse_expr_prefix`) - #165481 (Separate `Primitive::Bool` and make `#[repr($int)]` enums always use the ABI of $int) - #166290 (Require the next-solver for unsafe binders) - #165865 (Move more rustc lint attributes to lint helpers.) - #166221 (Unstably implement `StaticAllocator` on fundamental types)
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 23, 2026
Rollup merge of #166221 - maxdexh:reserve-fundamental-static-alloc-impls, r=clarfonthey Unstably implement `StaticAllocator` on fundamental types Unstably implements `StaticAllocator` on `Box` and `Pin`. These types are fundamental, and we use `StaticAllocator` in bounds (specifically `impl From<Box<T, A>> for Pin<Box<T, A>> where A: StaticAllocator`, so adding impls for them would generally be already breaking due to coherence. The impls here are barely not breaking, because all `StaticAllocator` implementors are currently considered local to std, so any code that tries to observe the non-existence of these impls through coherence fails with something like "upstream could add a `StaticAllocator` impl to `Box<Global>`". This isn't really ideal, so to prevent any accidents in the future, this PR adds these `#[unstable_feature_bound]` impls. The impl for `Box` could be added stably, but I'd rather do that in a separate PR, because doing so would require FCP (it would allow `Box::into_pin(Box::new_in(1, Box::new(Global)))`), and I don't want this semver risk at the back of my mind for weeks. The impl for `Pin` is not correct, and only meant as a reservation impl (hence the separate "`internal_`" feature gate). See the `FIXME` comment above it. r? clarfonthey
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Nov 24, 2026
Rollup of 5 pull requests Successful merges: - rust-lang/rust#164537 (Parser: Clean up `parse_expr_dot_or_call_with` & simplify `parse_expr_prefix`) - rust-lang/rust#165481 (Separate `Primitive::Bool` and make `#[repr($int)]` enums always use the ABI of $int) - rust-lang/rust#166290 (Require the next-solver for unsafe binders) - rust-lang/rust#165865 (Move more rustc lint attributes to lint helpers.) - rust-lang/rust#166221 (Unstably implement `StaticAllocator` on fundamental types)
mehmettoplu-rs
pushed a commit
to mehmettoplu-rs/miri
that referenced
this pull request
Nov 24, 2026
Rollup of 5 pull requests Successful merges: - rust-lang/rust#164537 (Parser: Clean up `parse_expr_dot_or_call_with` & simplify `parse_expr_prefix`) - rust-lang/rust#165481 (Separate `Primitive::Bool` and make `#[repr($int)]` enums always use the ABI of $int) - rust-lang/rust#166290 (Require the next-solver for unsafe binders) - rust-lang/rust#165865 (Move more rustc lint attributes to lint helpers.) - rust-lang/rust#166221 (Unstably implement `StaticAllocator` on fundamental types)
mehmettoplu-rs
pushed a commit
to mehmettoplu-rs/rustc_codegen_gcc
that referenced
this pull request
Nov 27, 2026
Rollup of 5 pull requests Successful merges: - rust-lang/rust#164537 (Parser: Clean up `parse_expr_dot_or_call_with` & simplify `parse_expr_prefix`) - rust-lang/rust#165481 (Separate `Primitive::Bool` and make `#[repr($int)]` enums always use the ABI of $int) - rust-lang/rust#166290 (Require the next-solver for unsafe binders) - rust-lang/rust#165865 (Move more rustc lint attributes to lint helpers.) - rust-lang/rust#166221 (Unstably implement `StaticAllocator` on fundamental types)
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.
Unstably implements
StaticAllocatoronBoxandPin.These types are fundamental, and we use
StaticAllocatorin bounds (specificallyimpl From<Box<T, A>> for Pin<Box<T, A>> where A: StaticAllocator, so adding impls for them would generally be already breaking due to coherence.The impls here are barely not breaking, because all
StaticAllocatorimplementors are currently considered local to std, so any code that tries to observe the non-existence of these impls through coherence fails with something like "upstream could add aStaticAllocatorimpl toBox<Global>". This isn't really ideal, so to prevent any accidents in the future, this PR adds these#[unstable_feature_bound]impls.The impl for
Boxcould be added stably, but I'd rather do that in a separate PR, because doing so would require FCP (it would allowBox::into_pin(Box::new_in(1, Box::new(Global)))), and I don't want this semver risk at the back of my mind for weeks.The impl for
Pinis not correct, and only meant as a reservation impl (hence the separate "internal_" feature gate). See theFIXMEcomment above it.r? clarfonthey