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

Implement ACP 429: add Lazy{Cell,Lock}::get[_mut] and force_mut #130476

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

workingjubilee
Copy link
Member

@workingjubilee workingjubilee commented Sep 17, 2024

Tracking issue for lazy_get: #129333

This lands the essential content of #129334 without adding DerefMut and without demanding that T-libs-api abrogate their procedure unnecessarily just to land a few functions. The case of the trait implementation can be considered in another PR.

In the implementation of `force_mut`, I chose performance over safety.
For `LazyLock` this isn't really a choice; the code has to be unsafe.
But for `LazyCell`, we can have a full-safe implementation, but it will
be a bit less performant, so I went with the unsafe approach.
@rustbot
Copy link
Collaborator

rustbot commented Sep 17, 2024

r? @Amanieu

rustbot has assigned @Amanieu.
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 Sep 17, 2024
@workingjubilee workingjubilee force-pushed the more-lazy-methods-take-2 branch 2 times, most recently from 1a9c521 to 6780eca Compare September 17, 2024 16:53
@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member Author

Finally ran down the last missing import.

Copy link
Member

@Amanieu Amanieu left a comment

Choose a reason for hiding this comment

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

r=me once comments are addressed.

library/core/src/cell/lazy.rs Outdated Show resolved Hide resolved
library/std/src/sync/lazy_lock.rs Outdated Show resolved Hide resolved
@Amanieu
Copy link
Member

Amanieu commented Sep 18, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 18, 2024

📌 Commit f22797d has been approved by Amanieu

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 Sep 18, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 18, 2024
…ake-2, r=Amanieu

Implement ACP 429: add `Lazy{Cell,Lock}::get[_mut]` and `force_mut`

Tracking issue for `lazy_get`: rust-lang#129333
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 18, 2024
…kingjubilee

Rollup of 9 pull requests

Successful merges:

 - rust-lang#97524 (Add `Thread::{into_raw, from_raw}`)
 - rust-lang#127988 (Do not ICE with incorrect empty suggestion)
 - rust-lang#129422 (Gate `repr(Rust)` correctly on non-ADT items)
 - rust-lang#129934 (Win: Open dir for sync access in remove_dir_all)
 - rust-lang#130450 (Reduce confusion about `make_indirect_byval` by renaming it)
 - rust-lang#130476 (Implement ACP 429: add `Lazy{Cell,Lock}::get[_mut]` and `force_mut`)
 - rust-lang#130487 (Update the minimum external LLVM to 18)
 - rust-lang#130513 (Clarify docs for std::fs::File::write)
 - rust-lang#130522 ([Clippy] Swap `manual_retain` to use diagnostic items instead of paths)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 12b59e5 into rust-lang:master Sep 19, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 19, 2024
Rollup merge of rust-lang#130476 - workingjubilee:more-lazy-methods-take-2, r=Amanieu

Implement ACP 429: add `Lazy{Cell,Lock}::get[_mut]` and `force_mut`

Tracking issue for `lazy_get`: rust-lang#129333
@workingjubilee workingjubilee deleted the more-lazy-methods-take-2 branch September 19, 2024 03:12
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