Skip to content

Audit uses of static mut #678

Closed
Closed
@ChrisDenton

Description

@ChrisDenton

The new warning is causing CI to fail. E.g:

error: creating a mutable reference to mutable static is discouraged
   --> src/symbolize/gimli.rs:368:11
    |
368 |         f(MAPPINGS_CACHE.get_or_insert_with(Cache::new))
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
    = note: `-D static-mut-refs` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(static_mut_refs)]`

error: could not compile `backtrace` (lib) due to 1 previous error

Either we should allow the lint and add some comments or else actually fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions