mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 13:06:28 +03:00
Tweak note condition
This commit is contained in:
@@ -214,7 +214,7 @@ fn interior_mutability_suggestion(
|
||||
|
||||
let sugg =
|
||||
static_mutability_span(cx, def_id).map(|span| StaticMutRefsInteriorMutabilitySugg { span });
|
||||
(true, sugg)
|
||||
(sugg.is_none(), sugg)
|
||||
}
|
||||
|
||||
fn static_mutability_span(cx: &LateContext<'_>, def_id: DefId) -> Option<Span> {
|
||||
|
||||
@@ -4,9 +4,8 @@ error: creating a shared reference to mutable static
|
||||
LL | let _lock = unsafe { STDINOUT_MUTEX.lock().unwrap() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
|
||||
|
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
|
||||
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
||||
= help: use a type that relies on "interior mutability" instead; to read more on this, visit <https://doc.rust-lang.org/reference/interior-mutability.html>
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
|
||||
= note: `#[deny(static_mut_refs)]` (part of `#[deny(rust_2024_compatibility)]`) on by default
|
||||
help: this type already provides "interior mutability", so its binding doesn't need to be declared as mutable
|
||||
|
|
||||
|
||||
@@ -10,7 +10,6 @@ LL | | });
|
||||
| |______________^ shared reference to mutable static
|
||||
|
|
||||
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
||||
= help: use a type that relies on "interior mutability" instead; to read more on this, visit <https://doc.rust-lang.org/reference/interior-mutability.html>
|
||||
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html>
|
||||
= note: `#[warn(static_mut_refs)]` (part of `#[warn(rust_2024_compatibility)]`) on by default
|
||||
help: this type already provides "interior mutability", so its binding doesn't need to be declared as mutable
|
||||
|
||||
Reference in New Issue
Block a user