Repository: rust
Issue: ICE: each unstable `LintExpectationId` must have a matching stable id
Labels: I-ICE,T-compiler,C-bug,S-needs-repro,S-needs-info

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.
http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/
-->

On 1.81.0 stable and 1.82.0-beta.5 I get an ICE when `#[expect()]`ing various Clippy lints on a struct field. Interestingly, I could repro the ICE for `clippy::unreadable_literal`, `clippy::unusual_byte_groupings`, and `clippy::unseparated_literal_suffix` but not `clippy::identity_op`. I could not repro on `1.83.0-nightly (80d82ca22 2024-09-27)`, only on stable and beta.

### Code

```Rust
#![allow(unused)]
#![warn(clippy::pedantic, clippy::unseparated_literal_suffix)]

struct Test {
    field: u64
}

fn main() {
    let _ = Test {
        #[expect(
        //    clippy::unreadable_literal,
        //    clippy::identity_op,
            clippy::unusual_byte_groupings,
        //    clippy::unseparated_literal_suffix,
        )]
        field: 0x1234123412_341234u64 + 0,
    };
}
```

Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=216f4208339c66578039fc1ba22f6264

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7
```

```
rustc 1.82.0-beta.5 (6a3b69c6b 2024-09-27)
binary: rustc
commit-hash: 6a3b69c6b0529151da5fb4568961519a80adccf9
commit-date: 2024-09-27
host: x86_64-unknown-linux-gnu
release: 1.82.0-beta.5
LLVM version: 19.1.0
```

### Error output

```
thread 'rustc' panicked at compiler/rustc_errors/src/diagnostic.rs:373:18:
each unstable `LintExpectationId` must have a matching stable id
stack backtrace:
   0:     0x718e5c74e3e5 - std::backtrace_rs::backtrace::libunwind::trace::h649ab3318d3445c5
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x718e5c74e3e5 - std::backtrace_rs::backtrace::trace_unsynchronized::hf4bb60c3387150c3
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x718e5c74e3e5 - std::sys::backtrace::_print_fmt::hd9186c800e44bd00
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:65:5
   3:     0x718e5c74e3e5 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h1b9dad2a88e955ff
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:40:26
   4:     0x718e5c79deeb - core::fmt::rt::Argument::fmt::h351a7824f737a6a0
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/rt.rs:173:76
   5:     0x718e5c79deeb - core::fmt::write::h4b5a1270214bc4a7
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/fmt/mod.rs:1182:21
   6:     0x718e5c742f6f - std::io::Write::write_fmt::hd04af345a50c312d
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/io/mod.rs:1827:15
   7:     0x718e5c750bd1 - std::sys::backtrace::BacktraceLock::print::h68d41b51481bce5c
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:43:9
   8:     0x718e5c750bd1 - std::panicking::default_hook::{{closure}}::h96ab15e9936be7ed
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:269:22
   9:     0x718e5c7508ac - std::panicking::default_hook::h3cacb9c27561ad33
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:296:9
  10:     0x718e58e93420 - std[1f2242ed6435445e]::panicking::update_hook::<alloc[7b1462a1eb55c293]::boxed::Box<rustc_driver_impl[8683aa37472b7dde]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x718e5c75159f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hce7569f4ca5d1b64
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2084:9
  12:     0x718e5c75159f - std::panicking::rust_panic_with_hook::hfe205f6954b2c97b
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:808:13
  13:     0x718e5c7511c7 - std::panicking::begin_panic_handler::{{closure}}::h6cb44b3a50f28c44
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:674:13
  14:     0x718e5c74e8a9 - std::sys::backtrace::__rust_end_short_backtrace::hf1c1f2a92799bb0e
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:168:18
  15:     0x718e5c750e54 - rust_begin_unwind
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
  16:     0x718e5c79a4a3 - core::panicking::panic_fmt::h3d8fc78294164da7
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
  17:     0x718e5c79a2fb - core::panicking::panic_display::h1c0e44fa90890272
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:264:5
  18:     0x718e5c79a2fb - core::option::expect_failed::h3a757a693188cc6e
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:2030:5
  19:     0x718e5bd38529 - <rustc_errors[48f1c32ead9577fc]::diagnostic::DiagInner>::update_unstable_expectation_id.cold
  20:     0x718e5b3bbcc3 - <rustc_errors[48f1c32ead9577fc]::DiagCtxtHandle>::update_unstable_expectation_id
  21:     0x718e5a62bd49 - rustc_lint[2400c89cc40e73c2]::levels::lint_expectations
  22:     0x718e5b29bba2 - rustc_query_impl[3625cc0592f96219]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3625cc0592f96219]::query_impl::lint_expectations::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ba2289ab3ae064d4]::query::erase::Erased<[u8; 8usize]>>
  23:     0x718e5b299e2a - rustc_query_system[200ca28aa7d9732c]::query::plumbing::try_execute_query::<rustc_query_impl[3625cc0592f96219]::DynamicConfig<rustc_query_system[200ca28aa7d9732c]::query::caches::SingleCache<rustc_middle[ba2289ab3ae064d4]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[3625cc0592f96219]::plumbing::QueryCtxt, false>
  24:     0x718e5b4826de - rustc_query_impl[3625cc0592f96219]::query_impl::lint_expectations::get_query_non_incr::__rust_end_short_backtrace
  25:     0x718e5b4823db - rustc_lint[2400c89cc40e73c2]::expect::check_expectations
  26:     0x718e5b482397 - rustc_query_impl[3625cc0592f96219]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3625cc0592f96219]::query_impl::check_expectations::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ba2289ab3ae064d4]::query::erase::Erased<[u8; 0usize]>>
  27:     0x718e5b4821d0 - rustc_query_system[200ca28aa7d9732c]::query::plumbing::try_execute_query::<rustc_query_impl[3625cc0592f96219]::DynamicConfig<rustc_query_system[200ca28aa7d9732c]::query::caches::DefaultCache<core[3cad2706d8bdcdc4]::option::Option<rustc_span[28a649581f99a5bd]::symbol::Symbol>, rustc_middle[ba2289ab3ae064d4]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[3625cc0592f96219]::plumbing::QueryCtxt, false>
  28:     0x718e5b481f99 - rustc_query_impl[3625cc0592f96219]::query_impl::check_expectations::get_query_non_incr::__rust_end_short_backtrace
  29:     0x718e5ac11560 - rustc_interface[53a414ae04dc6ffb]::passes::analysis
  30:     0x718e5ac105e7 - rustc_query_impl[3625cc0592f96219]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3625cc0592f96219]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ba2289ab3ae064d4]::query::erase::Erased<[u8; 1usize]>>
  31:     0x718e5b29ada2 - rustc_query_system[200ca28aa7d9732c]::query::plumbing::try_execute_query::<rustc_query_impl[3625cc0592f96219]::DynamicConfig<rustc_query_system[200ca28aa7d9732c]::query::caches::SingleCache<rustc_middle[ba2289ab3ae064d4]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[3625cc0592f96219]::plumbing::QueryCtxt, false>
  32:     0x718e5b29ab4f - rustc_query_impl[3625cc0592f96219]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x718e5b12c256 - rustc_interface[53a414ae04dc6ffb]::interface::run_compiler::<core[3cad2706d8bdcdc4]::result::Result<(), rustc_span[28a649581f99a5bd]::ErrorGuaranteed>, rustc_driver_impl[8683aa37472b7dde]::run_compiler::{closure#0}>::{closure#1}
  34:     0x718e5b07395b - std[1f2242ed6435445e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[53a414ae04dc6ffb]::util::run_in_thread_with_globals<rustc_interface[53a414ae04dc6ffb]::interface::run_compiler<core[3cad2706d8bdcdc4]::result::Result<(), rustc_span[28a649581f99a5bd]::ErrorGuaranteed>, rustc_driver_impl[8683aa37472b7dde]::run_compiler::{closure#0}>::{closure#1}, core[3cad2706d8bdcdc4]::result::Result<(), rustc_span[28a649581f99a5bd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3cad2706d8bdcdc4]::result::Result<(), rustc_span[28a649581f99a5bd]::ErrorGuaranteed>>
  35:     0x718e5b07372a - <<std[1f2242ed6435445e]::thread::Builder>::spawn_unchecked_<rustc_interface[53a414ae04dc6ffb]::util::run_in_thread_with_globals<rustc_interface[53a414ae04dc6ffb]::interface::run_compiler<core[3cad2706d8bdcdc4]::result::Result<(), rustc_span[28a649581f99a5bd]::ErrorGuaranteed>, rustc_driver_impl[8683aa37472b7dde]::run_compiler::{closure#0}>::{closure#1}, core[3cad2706d8bdcdc4]::result::Result<(), rustc_span[28a649581f99a5bd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3cad2706d8bdcdc4]::result::Result<(), rustc_span[28a649581f99a5bd]::ErrorGuaranteed>>::{closure#1} as core[3cad2706d8bdcdc4]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x718e5c75b5fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha1963004222e7822
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  37:     0x718e5c75b5fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1086ced1f7c494c2
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/boxed.rs:2070:9
  38:     0x718e5c75b5fb - std::sys::pal::unix::thread::Thread::new::thread_start::ha8af9c992ef0b208
                               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/pal/unix/thread.rs:108:17
  39:     0x718e559a1a94 - <unknown>
  40:     0x718e55a2ea34 - clone
  41:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml

note: rustc 1.81.0 (eeb90cda1 2024-09-04) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [lint_expectations] computing `#[expect]`ed lints in this crate
#1 [check_expectations] checking lint expectations (RFC 2383)
end of query stack
note: Clippy version: clippy 0.1.81 (eeb90cd 2024-09-04)
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
thread 'rustc' panicked at compiler/rustc_errors/src/diagnostic.rs:373:18:
each unstable `LintExpectationId` must have a matching stable id
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
   2: core::panicking::panic_display
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:264:5
   3: core::option::expect_failed
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:2030:5
   4: <rustc_errors::diagnostic::DiagInner>::update_unstable_expectation_id.cold
   5: <rustc_errors::DiagCtxtHandle>::update_unstable_expectation_id
   6: rustc_lint::levels::lint_expectations
      [... omitted 1 frame ...]
   7: rustc_lint::expect::check_expectations
      [... omitted 1 frame ...]
   8: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
   9: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml

note: rustc 1.81.0 (eeb90cda1 2024-09-04) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [lint_expectations] computing `#[expect]`ed lints in this crate
#1 [check_expectations] checking lint expectations (RFC 2383)
#2 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.81 (eeb90cd 2024-09-04)
```

</p>
</details>