Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: Mention clone-on-write mutation in Arc<T> #138341

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

xizheyin
Copy link
Contributor

@xizheyin xizheyin commented Mar 11, 2025

Fixes #138322

r? libs

@rustbot
Copy link
Collaborator

rustbot commented Mar 11, 2025

r? @ibraheemdev

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

@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 Mar 11, 2025
@rustbot rustbot assigned joboet and unassigned ibraheemdev Mar 11, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

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

Good idea! I have two minor suggestions:

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
@xizheyin
Copy link
Contributor Author

Thank you! I updated the changes. @joboet
Added

/// 3. Use [`Arc::get_mut`] when you know your `Arc` is not shared (has a reference count of 1),
///    which provides direct mutable access to the inner value without any cloning.

And,

/// inside an `Arc`. If you do need to mutate through an `Arc`, you have several options:

@xizheyin xizheyin requested a review from joboet March 13, 2025 12:45
@joboet
Copy link
Member

joboet commented Mar 17, 2025

Great, thank you!
@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 17, 2025

📌 Commit a9b536f has been approved by joboet

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 Mar 17, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#136355 (Add `*_value` methods to proc_macro lib)
 - rust-lang#137621 (Add std support to cygwin target)
 - rust-lang#137793 (Stablize anonymous pipe)
 - rust-lang#138341 (std: Mention clone-on-write mutation in Arc<T>)
 - rust-lang#138517 (Improve upvar analysis for deref of child capture)
 - rust-lang#138584 (Update Rust Foundation links in Readme)
 - rust-lang#138586 (Document `#![register_tool]`)
 - rust-lang#138590 (Flatten and simplify some control flow 🫓)
 - rust-lang#138592 (update change entry for rust-lang#137147)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 625278b into rust-lang:master Mar 17, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 17, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2025
Rollup merge of rust-lang#138341 - xizheyin:issue-138322, r=joboet

std: Mention clone-on-write mutation in Arc<T>

Fixes rust-lang#138322

r? libs
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.

mention Arc::make_mut alongside Mutex
6 participants