]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #100507 - cameron1024:suggest-lazy, r=compiler-errors
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 20 Aug 2022 05:08:59 +0000 (07:08 +0200)
committerGitHub <noreply@github.com>
Sat, 20 Aug 2022 05:08:59 +0000 (07:08 +0200)
commitc4b83ebe7c0e551c5e22abca259ef22d4cb0c509
tree23806a75e76323681aa26dae4c953f3a3b8dcbbb
parent368f08a65f66cdd0b26298fb86a175188d9c34bb
parent34e0d9a0bb409bb6c7fc45f1c222340b02989b8b
Rollup merge of #100507 - cameron1024:suggest-lazy, r=compiler-errors

suggest `once_cell::Lazy` for non-const statics

Addresses https://github.com/rust-lang/rust/issues/100410

Some questions:
 - removing the `if` seems to include too many cases (e.g. calls to non-const functions inside a `const fn`), but this code excludes the following case:
```rust
const FOO: Foo = non_const_fn();
```
Should we suggest `once_cell` in this case as well?
 - The original issue mentions suggesting `AtomicI32` instead of `Mutex<i32>`, should this PR address that as well?