Skip to content

Cleanup linked list#150344

Merged
bors merged 2 commits intorust-lang:mainfrom
hkBst:cleanup-linked-list
Dec 30, 2025
Merged

Cleanup linked list#150344
bors merged 2 commits intorust-lang:mainfrom
hkBst:cleanup-linked-list

Conversation

@hkBst
Copy link
Member

@hkBst hkBst commented Dec 24, 2025

  • Replaces some checked_sub().unwrap_or(0) with saturating_sub().
  • Replaces NonNull::from(Box::leak(node)) with Box::into_non_null(node)

@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 Dec 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 24, 2025

r? @jhpratt

rustbot has assigned @jhpratt.
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

Comment on lines 1322 to 1324
Copy link
Member Author

Choose a reason for hiding this comment

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

This moves code A down into impl block B, but the diff shows B being moved up past A.

So this actually moves into_raw and into_non_null (expand below this seeming addition) into an impl block that is generic over the allocator, such that they can accept Boxes that use an allocator different from the Global one. This is needed for the changes in linked_list.rs to replace Box::leak (which is also generic over allocator).

This probably needs some libs discussion/approval.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you make the diff smaller by separating A into it's own impl block without moving it?

Copy link
Member Author

@hkBst hkBst Dec 26, 2025

Choose a reason for hiding this comment

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

Good idea. That should probably work. Done now.

@rust-log-analyzer

This comment has been minimized.

@rust-cloud-vms rust-cloud-vms bot force-pushed the cleanup-linked-list branch 2 times, most recently from 27e8c16 to aee975a Compare December 26, 2025 06:44
@rust-log-analyzer

This comment has been minimized.

@jhpratt
Copy link
Member

jhpratt commented Dec 29, 2025

Pending CI passing

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 29, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the cleanup-linked-list branch from aee975a to eea3d79 Compare December 29, 2025 19:09
@hkBst
Copy link
Member Author

hkBst commented Dec 30, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 30, 2025
@jhpratt
Copy link
Member

jhpratt commented Dec 30, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 30, 2025

📌 Commit eea3d79 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors 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 Dec 30, 2025
bors added a commit that referenced this pull request Dec 30, 2025
…uwer

Rollup of 2 pull requests

Successful merges:

 - #150239 (Simplify `TypeFreshener` methods.)
 - #150344 (Cleanup linked list)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 596e1e3 into rust-lang:main Dec 30, 2025
11 checks passed
rust-timer added a commit that referenced this pull request Dec 30, 2025
Rollup merge of #150344 - hkBst:cleanup-linked-list, r=jhpratt

Cleanup linked list

 - Replaces some checked_sub().unwrap_or(0) with saturating_sub().
 - Replaces NonNull::from(Box::leak(node)) with Box::into_non_null(node)
@rustbot rustbot added this to the 1.94.0 milestone Dec 30, 2025
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.

6 participants

Comments