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

Replace a lazy RefCell<Option<T>> with OnceCell<T> #114155

Merged
merged 1 commit into from
Jul 29, 2023

Conversation

Zalathar
Copy link
Contributor

This code was using RefCell<Option<T>> to manually implement lazy initialization. Now that we have OnceCell in the standard library, we can just use that instead.

In particular, this avoids a confusing doubly-nested option, because the value being lazily computed is itself an Option<Symbol>.

@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2023

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 28, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@lcnr
Copy link
Contributor

lcnr commented Jul 28, 2023

r? @lcnr

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 28, 2023

📌 Commit 8745fdc has been approved by lcnr

It is now in the queue for this repository.

@rustbot rustbot assigned lcnr and unassigned b-naber Jul 28, 2023
@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 Jul 28, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 28, 2023
Replace a lazy `RefCell<Option<T>>` with `OnceCell<T>`

This code was using `RefCell<Option<T>>` to manually implement lazy initialization. Now that we have `OnceCell` in the standard library, we can just use that instead.

In particular, this avoids a confusing doubly-nested option, because the value being lazily computed is itself an `Option<Symbol>`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 28, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#114099 (privacy: no nominal visibility for assoc fns )
 - rust-lang#114128 (When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist)
 - rust-lang#114138 (Adjust spans correctly for fn -> method suggestion)
 - rust-lang#114146 (Skip reporting item name when checking RPITIT GAT's associated type bounds hold)
 - rust-lang#114147 (Insert RPITITs that were shadowed by missing ADTs that resolve to [type error])
 - rust-lang#114155 (Replace a lazy `RefCell<Option<T>>` with `OnceCell<T>`)
 - rust-lang#114164 (Add regression test for `--cap-lints allow` and trait bounds warning)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 048794d into rust-lang:master Jul 29, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 29, 2023
@Zalathar Zalathar deleted the once-cell branch July 29, 2023 01:42
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants