Skip to content

Commit fe2fb2b

Browse files
Mark-SimulacrumkpreidUrgau
authored
Apply suggestions from code review
Co-authored-by: Kevin Reid <[email protected]> Co-authored-by: Urgau <[email protected]>
1 parent 5985a17 commit fe2fb2b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

posts/2024-07-25-Rust-1.80.0.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ If you'd like to help us out by testing future releases, you might consider upda
2121

2222
### `LazyCell` and `LazyLock`
2323

24-
These "lazy" types delay the initialization of their data until first access. They are similar to the `OnceCell` and `OnceLock` types [stabilized in 1.70](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#oncecell-and-oncelock), but with the initialization function included in the type.
24+
These "lazy" types delay the initialization of their data until first access. They are similar to the `OnceCell` and `OnceLock` types [stabilized in 1.70](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#oncecell-and-oncelock), but with the initialization function included in the cell.
2525

26-
`LazyLock` is the thread-safe option, making it suitable for places like `static` values. For example, both the `spawn` thread and the main `scope` will see the exact same duration below, since `LAZY_TIME` will be initialized once, by whichever ends up accessing the static first. Neither use has to know *how* to initialize it though, like you would with `OnceLock::get_or_init`.
26+
`LazyLock` is the thread-safe option, making it suitable for places like `static` values. For example, both the `spawn` thread and the main `scope` will see the exact same duration below, since `LAZY_TIME` will be initialized once, by whichever ends up accessing the static first. Neither use has to know *how* to initialize it, unlike they would with `OnceLock::get_or_init()`.
2727

2828
```rust
2929
use std::sync::LazyLock;
@@ -42,13 +42,13 @@ fn main() {
4242
}
4343
```
4444

45-
`LazyCell` does the same thing without thread synchronization, so it doesn't implement `Sync` needed for `static`, but it can still be used in `thread_local!` statics (with distinct initialization per thread). Either type can also be used in other data structures as well, depending on thread-safety needs, so lazy initialization is available everywhere!
45+
`LazyCell` does the same thing without thread synchronization, so it doesn't implement `Sync`, which is needed for `static`, but it can still be used in `thread_local!` statics (with distinct initialization per thread). Either type can also be used in other data structures as well, depending on thread-safety needs, so lazy initialization is available everywhere!
4646

4747
### Checked `cfg` names and values
4848

49-
In 1.79, `rustc` stabilized a [`--check-cfg` flag](https://doc.rust-lang.org/rustc/check-cfg.html), and now Cargo 1.80 is enabling those checks for all `cfg` names that it knows (in addition to those built-in to `rustc`). This includes feature names from `Cargo.toml` as well as new `cargo::rustc-check-cfg` output from build scripts.
49+
In 1.79, `rustc` stabilized a [`--check-cfg` flag](https://doc.rust-lang.org/rustc/check-cfg.html), and now Cargo 1.80 is enabling those checks for all `cfg` names and values that it knows (in addition to the [well known names and values](https://doc.rust-lang.org/rustc/check-cfg.html#well-known-names-and-values) from `rustc`). This includes feature names from `Cargo.toml` as well as new `cargo::rustc-check-cfg` output from build scripts.
5050

51-
Check failures are reported by the `unexpected_cfgs` lint, which is meant to catch typos or other misconfiguration. For example, in a project with an optional `rayon` dependency, this code is configured for the wrong name:
51+
Unexpected cfgs are reported by the warn-by-default `unexpected_cfgs` lint, which is meant to catch typos or other misconfiguration. For example, in a project with an optional `rayon` dependency, this code is configured for the wrong `feature` value:
5252

5353
```rust
5454
fn main() {
@@ -79,7 +79,7 @@ warning: unexpected `cfg` condition value: `crayon`
7979

8080
The same warning is reported regardless of whether the actual `rayon` feature is enabled or not.
8181

82-
The `[lints]` table in the manifest can also be used to extend the known values for custom `cfg` options.
82+
The `[lints]` table in the `Cargo.toml` manifest can also be used to extend the list of known names and values for custom `cfg`. `rustc` automatically provides [the syntax](https://doc.rust-lang.org/rustc/check-cfg.html#specifying-expected-names-and-values) to use in the warning.
8383

8484
```toml
8585
[lints.rust]

0 commit comments

Comments
 (0)