-
Notifications
You must be signed in to change notification settings - Fork 13.3k
OnceCell docs: empty/full terminology v.s. (un)initialized #85716
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
Comments
"initialized" corresponds with the API methods like |
What about |
Given links are dangling, but I think this is about:
I believe the states should be called empty and initialized, with the transition being initializing.
|
@rustbot labels: +E-easy |
Hey, @rustbot claim |
@Pyr0de it's just my informed opinion, and what I would do (you may find out when your PR gets reviewed that other people disagree or not). BTW I think "full" should be replaced by something like "already initialized". Anyway use your best judgment! Good luck. |
Hey,
Example: "Creates a new unset cell" Or does this change the meaning? |
@Pyr0de I think that would also be fine. |
Should I also change the comments to match the changes or just the docs? |
@Pyr0de if you are talking about comments in code examples, then yes change those to match as well. |
I did make the changes in the code example comments. |
@Pyr0de I'm not sure what you mean by "code comments left for explaining the code, not part of the docs". Ah do you mean like ordinary non-doc comments? Ideally yes. |
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
Rollup merge of rust-lang#136289 - Pyr0de:oncecell-docs, r=tgross35 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
Documentation at:
Appears to use "empty" and "uninitialized" interchangeably to describe the state of a given cell, and similarly "full" and "initialized". I think it’d be better to pick one set of terminology and stick to it consistently. Using empty/full might be better because "uninitialized" terminology is already used for
std::mem::MaybeUninit
, and manipulating an empty cell does not have the memory-safety risks of reading bytes fromMaybeUninit::uninit()
.The text was updated successfully, but these errors were encountered: