Skip to content

Commit

Permalink
change diag references from once_cell crate to LazyLock
Browse files Browse the repository at this point in the history
  • Loading branch information
pitaj committed Apr 17, 2024
1 parent bf11b8b commit 66b0c23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
}

if let ConstContext::Static(_) = ccx.const_kind() {
err.note("consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell");
err.note("consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`");
}

err
Expand Down
8 changes: 2 additions & 6 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1265,9 +1265,7 @@ declare_lint! {
/// * If the value can be computed at compile-time, consider using
/// const-compatible values (see [Constant Evaluation]).
/// * For more complex single-initialization cases, consider using a
/// third-party crate, such as [`lazy_static`] or [`once_cell`].
/// * If you are using the [nightly channel], consider the new
/// [`lazy`] module in the standard library.
/// [`std::sync::LazyLock`].
/// * If you truly need a mutable global, consider using a [`static`],
/// which has a variety of options:
/// * Simple data types can be directly defined and mutated with an
Expand All @@ -1282,9 +1280,7 @@ declare_lint! {
/// [Constant Evaluation]: https://doc.rust-lang.org/reference/const_eval.html
/// [`static`]: https://doc.rust-lang.org/reference/items/static-items.html
/// [mutable `static`]: https://doc.rust-lang.org/reference/items/static-items.html#mutable-statics
/// [`lazy`]: https://doc.rust-lang.org/nightly/std/lazy/index.html
/// [`lazy_static`]: https://crates.io/crates/lazy_static
/// [`once_cell`]: https://crates.io/crates/once_cell
/// [`std::sync::LazyLock`]: https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html
/// [`atomic`]: https://doc.rust-lang.org/std/sync/atomic/index.html
/// [`Mutex`]: https://doc.rust-lang.org/std/sync/struct.Mutex.html
pub CONST_ITEM_MUTATION,
Expand Down

0 comments on commit 66b0c23

Please sign in to comment.