RUST_2024_INCOMPATIBLE_PAT in rustc_lint_defs::builtin - Rust
Description: The `rust_2024_incompatible_pat` lint detects patterns whose meaning will change in the Rust 2024 edition.

Skip to main content

## RUST_2024_INCOMPATIBLE_PAT

# Static RUST_2024_INCOMPATIBLE_PAT

Source

    pub static RUST_2024_INCOMPATIBLE_PAT: &Lint

Expand description

The `rust_2024_incompatible_pat` lint detects patterns whose meaning will change in the Rust 2024 edition.

#### §Example

ⓘ

    #![warn(rust_2024_incompatible_pat)]

    if let Some(&a) = &Some(&0u8) {
        let _: u8 = a;
    }
    if let Some(mut _a) = &mut Some(0u8) {
        _a = 7u8;
    }

{{produces}}

#### §Explanation

In Rust 2024 and above, the `mut` keyword does not reset the pattern binding mode, and nor do `&` or `&mut` patterns. The lint will suggest code that has the same meaning in all editions.