-
Notifications
You must be signed in to change notification settings - Fork 13k
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
OnceCell & OnceLock docs: Using (un)initialized consistently #136289
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ChrisDenton (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Fwiw I think "initialized" and "uninitialized" is the better terminology here. "Initialized" makes it clear that it is a one-time occurrence, where as set/empty sounds more like |
There is API to unset these types, but the main problem they solve is initialization behind a shared |
You do have a point there! Fundamentally there are 3 things which need a name that can be used consistently. There is the empty/unset/uninitialized state, the full/set/initialized state, and the transition set/initialize:
|
r? tgross35 Since tgross35 has started but feel free to flip it back to me if you'd prefer. Edit: I used the wrong command initially, sorry! Corrected now. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Actually, I think @tgross35 has convinced me that uninitialized ---initialize---> initialized is the way to go, and it goes with most of the methods that end in |
Could you suggest some way to show this information? |
Maybe something like: A OnceCell conceptually has two states, called the uninitialized state and the initialized state. Like an That would do the trick I think. |
@hkBst @tgross35 @rustbot review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a handful of places where the wording can be simplified, plus a slight terminology adjustment to be more consistent with the other cell types. But the rest of the wording looks better to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two nits then r=me
Thanks for all the work getting this through! @bors r+ rollup |
OnceCell & OnceLock docs: Using (un)initialized consistently Changed * `set` / `initialize` / `full` to `initialized state` * `uninitialize` / `empty` to `uninitialized state` * `f` to `f()` * Added explaination of `uninitialized state` & `initialized state` [OnceCell Docs](https://doc.rust-lang.org/nightly/std/cell/struct.OnceCell.html) [OnceLock Docs](https://doc.rust-lang.org/nightly/std/sync/struct.OnceLock.html) Fixes rust-lang#85716 `@rustbot` label +A-docs
OnceCell & OnceLock docs: Using (un)initialized consistently Changed * `set` / `initialize` / `full` to `initialized state` * `uninitialize` / `empty` to `uninitialized state` * `f` to `f()` * Added explaination of `uninitialized state` & `initialized state` [OnceCell Docs](https://doc.rust-lang.org/nightly/std/cell/struct.OnceCell.html) [OnceLock Docs](https://doc.rust-lang.org/nightly/std/sync/struct.OnceLock.html) Fixes rust-lang#85716 ``@rustbot`` label +A-docs
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#136289 (OnceCell & OnceLock docs: Using (un)initialized consistently) - rust-lang#136299 (Ignore NLL boring locals in polonius diagnostics) - rust-lang#136411 (Omit argument names from function pointers that do not have argument names) - rust-lang#136430 (Use the type-level constant value `ty::Value` where needed) - rust-lang#136476 (Remove generic `//@ ignore-{wasm,wasm32,emscripten}` in tests) - rust-lang#136484 (Notes on types/traits used for in-memory query caching) - rust-lang#136493 (platform-support: document CPU baseline for x86-32 targets) - rust-lang#136498 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
Changed
set
/initialize
/full
toinitialized state
uninitialize
/empty
touninitialized state
f
tof()
uninitialized state
&initialized state
OnceCell Docs
OnceLock Docs
Fixes #85716
@rustbot label +A-docs