Skip to content

Assorted allocator nitpicks - #161115

Merged
rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
nia-e:allocator-nitpicks
Aug 19, 2026
Merged

Assorted allocator nitpicks#161115
rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
nia-e:allocator-nitpicks

Conversation

@nia-e

@nia-e nia-e commented Aug 14, 2026

Copy link
Copy Markdown
Member

View all comments

Small things that got missed in #157428, doc language cleanup for allocator, and a rename that closes #158344. cc @rust-lang/wg-allocators. pending libs bikeshed decision on the naming of into_raw_parts_with_alloc

r? clarfonthey

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 14, 2026
Comment thread library/core/src/alloc/mod.rs
Comment thread library/alloc/src/vec/mod.rs
Comment thread library/core/src/alloc/mod.rs
@clarfonthey

Copy link
Copy Markdown
Contributor

r=me minus const bound note. (either remove unused const bound on both, or constify both)

@clarfonthey

clarfonthey commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

New changes look good too, but will hold merge in case you have anything else to add. (r=me)

@rust-log-analyzer

This comment has been minimized.

Comment thread library/core/src/alloc/mod.rs Outdated
Comment thread library/core/src/alloc/mod.rs Outdated
Comment thread library/core/src/alloc/mod.rs Outdated
Comment thread library/core/src/alloc/mod.rs Outdated
@rust-log-analyzer

This comment has been minimized.

Comment thread library/core/src/alloc/mod.rs
Comment thread library/core/src/alloc/mod.rs Outdated
Comment thread library/core/src/alloc/mod.rs

@bushrat011899 bushrat011899 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One very minor nit, otherwise looks good to me!

View changes since this review

Comment thread library/core/src/alloc/mod.rs Outdated
Comment thread library/core/src/alloc/mod.rs
Comment thread library/core/src/alloc/mod.rs Outdated
Comment thread library/core/src/alloc/mod.rs Outdated
Comment thread library/core/src/alloc/mod.rs
@nia-e

nia-e commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

@bors r=clarfonthey rollup

@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit be759d2 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 18, 2026
@nia-e

nia-e commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

forgot to squash, oopers

@bors r-

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 18, 2026
@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@nia-e

nia-e commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

@bors squash

@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🚧 Squashing... this can take a few minutes.

@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

❗ Failed to push the squashed commit to nia-e/rust:allocator-nitpicks: Push timeouted

ref mut const unstable matching ref

vec, vecdeque: rename alloc to allocator

staticallocator on ref mut as well

wording will be the death of me

words order words random word words random good

eeeeeeeeeeeee

oh yeah these need the bound
@nia-e
nia-e force-pushed the allocator-nitpicks branch from cc3398f to 1724501 Compare August 18, 2026 18:48
@maxdexh

maxdexh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

I can see someone wants to get this merged 😂

@nia-e

nia-e commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

i also added the AllocatorClone bound to the conversion from Box to {Ar,R}c (mostly to prevent anyone from doing it on stable w/ a custom allocator, even though it's sound without since we gate Clone for {Ar,R}c)

@maxdexh

maxdexh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Probably don't do that, you can write that downstream for Box<LocalType, MyAlloc>. (although i guess only for Rc<T, Global>?)

@nia-e

nia-e commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

yep. though im okay keeping it so you can create an Rc with a custom allocator since it wouldn't be clonable

@maxdexh

maxdexh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

I don't think you can call that impl for allocators other than global? I'll do more testing around fundamental in general before stabilization because I feel like there's some weird stuff here

@nia-e

nia-e commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

we want to eventually offer From<Box<T, A: Allocator>> for Rc<T, A>. i guess the right call here is to just stabilise that and it's fine bc you can never clone that rc. i'll just change it back to that

@maxdexh

maxdexh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

If you can call that, that's already problematic because we also want to change the Send and Sync impl on Arc

@maxdexh

maxdexh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

There will have to be another PR with API stuff anyway, since some of the impls need to be generalized so that users don't write them themselves. maybe not

Comment thread library/core/src/alloc/mod.rs Outdated
/// allocated memory.
/// `Allocator` is mostly designed to be implemented on ZSTs, references, or smart pointers,
/// but can also be implemented directly on the underlying memory-owning type so long as it
/// upholds the necessary guarantees. In general, an allocator for `MyAlloc([u8; N])` cannot be

@clarfonthey clarfonthey Aug 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// upholds the necessary guarantees. In general, an allocator for `MyAlloc([u8; N])` cannot be
/// upholds the necessary guarantees. In general, an allocator `MyAlloc([u8; N])` cannot be

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, maybe it's better to just say you can't have an allocator like this realistically and say "it needs to be more complicated than e.g. MyAlloc([u8; N])

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@nia-e

nia-e commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

ready on my end, feel free to r+ this once you've reviewed clar ^

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors r+ rollup

Looked through all remaining comments, everything looks to be resolved.

@rust-bors

rust-bors Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7d40fdb has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 18, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 18, 2026
…nthey

Assorted allocator nitpicks

Small things that got missed in rust-lang#157428, doc language cleanup for allocator, and a rename that closes rust-lang#158344. cc @rust-lang/wg-allocators. pending libs bikeshed decision on the naming of `into_raw_parts_with_alloc`

r? clarfonthey
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 19, 2026
…nthey

Assorted allocator nitpicks

Small things that got missed in rust-lang#157428, doc language cleanup for allocator, and a rename that closes rust-lang#158344. cc @rust-lang/wg-allocators. pending libs bikeshed decision on the naming of `into_raw_parts_with_alloc`

r? clarfonthey
rust-bors Bot pushed a commit that referenced this pull request Aug 19, 2026
Rollup of 18 pull requests

Successful merges:

 - #154210 (fix: fix the capture behavior of `if let` in closures)
 - #156176 (Initial implementation of `FnPtr` trait)
 - #160767 (Unify E0117 foreign-trait label for ADT/primitive types with existing Slice/Array/Tuple handling)
 - #161297 (std: use UNIX's `Instant` and `SystemTime` on Hermit)
 - #160489 (Adding diagnostic item markers for multiple fs functions and structs)
 - #160643 (Require windowed (and exception) for Xtensa ABI)
 - #161088 (suppress projection errors already covered by a trait error)
 - #161114 (Remove fields from TypeKind: Struct, Enum, Union and Tuple)
 - #161115 (Assorted allocator nitpicks)
 - #161220 (bootstrap: Allow `./x fix --allow-dirty`)
 - #161296 (Enable overflow checks in `rustc_thread_pool`)
 - #161298 (remove rustc_error_messages dependency)
 - #161304 (Rename test so it matches the issue)
 - #161309 (`allow(non_camel_case_types)` in `minicore.rs`)
 - #161315 (Relax codgen test variable regex)
 - #161318 (Doc: clarify how `Read::bytes` handling Interrupted errors)
 - #161321 (Update books)
 - #161335 ([compiletest] Use the correct rustc lib directory for query_rustc_output)
@rust-bors
rust-bors Bot merged commit 63f0cfc into rust-lang:main Aug 19, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 19, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 19, 2026
Rollup merge of #161115 - nia-e:allocator-nitpicks, r=clarfonthey

Assorted allocator nitpicks

Small things that got missed in #157428, doc language cleanup for allocator, and a rename that closes #158344. cc @rust-lang/wg-allocators. pending libs bikeshed decision on the naming of `into_raw_parts_with_alloc`

r? clarfonthey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

with_allocator and with_alloc are named inconsistently.

9 participants