Skip to content

stabilize smart pointer map functions - #160534

Open
Qelxiros wants to merge 1 commit into
rust-lang:mainfrom
Qelxiros:stabilize-smart-pointer-map
Open

stabilize smart pointer map functions#160534
Qelxiros wants to merge 1 commit into
rust-lang:mainfrom
Qelxiros:stabilize-smart-pointer-map

Conversation

@Qelxiros

@Qelxiros Qelxiros commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Tracking issue: #144419
@rustbot modify labels: +T-libs-api

@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 4, 2026
@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

r? @Darksonn

rustbot has assigned @Darksonn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from 6 candidates

@rustbot rustbot added the T-libs-api [DEPRECATED; DO NOT USE] label Aug 4, 2026
@rustbot

This comment has been minimized.

@Qelxiros
Qelxiros force-pushed the stabilize-smart-pointer-map branch from a55c402 to 8279572 Compare August 4, 2026 23:44
@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Darksonn

Darksonn commented Aug 5, 2026

Copy link
Copy Markdown
Member

Sorry I'm at capacity for the next two weeks.

@rustbot reroll

@rustbot rustbot assigned nia-e and unassigned Darksonn Aug 5, 2026
@nia-e nia-e added needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 5, 2026
@rust-rfcbot

rust-rfcbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

@dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. and removed needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Aug 5, 2026
@clarfonthey clarfonthey removed the T-libs-api [DEPRECATED; DO NOT USE] label Aug 12, 2026
@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Aug 18, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@maxdexh

maxdexh commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Is there a reason custom allocators were not included in the implementation?

@nia-e

nia-e commented Aug 23, 2026

Copy link
Copy Markdown
Member

...huh. It might honestly just be an oversight? I think it should be sound.

cc @Amanieu @BurntSushi @dtolnay @joshtriplett @the8472 (can't ping the old libs-api anymore) as ppl with checkboxes here - should we block this on adding an allocator param?

@nia-e nia-e added the I-libs-nominated Nominated for discussion during a libs team meeting. label Aug 23, 2026
@maxdexh

maxdexh commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Allocators are not stable API anyway. The implementation looks simple enough that it should be possible to just jam it in, except that the transmute in Box::map needs to be into_raw_with... + from_raw_in (why is it even using transmute for this?)

If you want I can just write a PR right now

@nia-e

nia-e commented Aug 23, 2026

Copy link
Copy Markdown
Member

Wouldn't it be breaking to move this later from an impl for Box<T> into impl for Box<T, A>? if not then ignore me ^^

@maxdexh

maxdexh commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

I mean just changing it before stabilization without starting another FCP.

Also I don't think it's breaking even if done later because it would take Box<T, A> with the allocator type in a param. If that's breaking then almost all additions of A: Allocator in the past were breaking.

@maxdexh

This comment was marked as resolved.

@maxdexh

maxdexh commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Alright I wrote a PR (#161617). Feel free to do whatever you want with it. If you decide to stabilize first, I'll update it afterwards

@edwloef

edwloef commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Stabilizing Box::map should probably be blocked on the decision on whether Box::take is OK to exist, since they suffer from the same problem as far as I can tell. See #160436 (comment)

@maxdexh

maxdexh commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Yup, we discussed this on zulip too. It's probably fine but it'll need some thinking

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 25, 2026
…=nia-e

Add custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`

Adds custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`.

Not on `UniqueArc`/`UniqueRc` because too much allocator-related API is missing atm and I didn't want to end up writing unsound garbage. The `else` branch in those needs to drop a weakref, I'll get to that later.

cc rust-lang#160534

r? nia-e
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 25, 2026
…=nia-e

Add custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`

Adds custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`.

Not on `UniqueArc`/`UniqueRc` because too much allocator-related API is missing atm and I didn't want to end up writing unsound garbage. The `else` branch in those needs to drop a weakref, I'll get to that later.

cc rust-lang#160534

r? nia-e
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 25, 2026
…=nia-e

Add custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`

Adds custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`.

Not on `UniqueArc`/`UniqueRc` because too much allocator-related API is missing atm and I didn't want to end up writing unsound garbage. The `else` branch in those needs to drop a weakref, I'll get to that later.

cc rust-lang#160534

r? nia-e
@nia-e nia-e removed the I-libs-nominated Nominated for discussion during a libs team meeting. label Aug 25, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 25, 2026
…=nia-e

Add custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`

Adds custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`.

Not on `UniqueArc`/`UniqueRc` because too much allocator-related API is missing atm and I didn't want to end up writing unsound garbage. The `else` branch in those needs to drop a weakref, I'll get to that later.

cc rust-lang#160534

r? nia-e
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 25, 2026
…=nia-e

Add custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`

Adds custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`.

Not on `UniqueArc`/`UniqueRc` because too much allocator-related API is missing atm and I didn't want to end up writing unsound garbage. The `else` branch in those needs to drop a weakref, I'll get to that later.

cc rust-lang#160534

r? nia-e
rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
Rollup merge of #161617 - maxdexh:can-i-has-map-allocator, r=nia-e

Add custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`

Adds custom allocators to `(try_)map` on `Box`, `Rc`, `Arc`.

Not on `UniqueArc`/`UniqueRc` because too much allocator-related API is missing atm and I didn't want to end up writing unsound garbage. The `else` branch in those needs to drop a weakref, I'll get to that later.

cc #160534

r? nia-e
@rust-bors

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #161772) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

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

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. 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.

9 participants