Skip to content

ICE: capacity overflow #14882

Open
Open
@matthiaskrgr

Description

@matthiaskrgr

Summary

#![feature(deref_patterns)]
fn main() {
  match * "" {
    "" => {}
    _ => {}
  }
}

Version

rustc 1.89.0-nightly (2eef47813 2025-05-22)
binary: rustc
commit-hash: 2eef47813f25df637026ce3288880e5c587abd92
commit-date: 2025-05-22
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

Error output

Backtrace

warning: the feature `deref_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
--> code.rs:1:12
|
1 | #![feature(deref_patterns)]
|            ^^^^^^^^^^^^^^
|
= note: see issue #87121 <https://github.com/rust-lang/rust/issues/87121> for more information
= note: `#[warn(incomplete_features)]` on by default


thread 'rustc' panicked at /rustc/2eef47813f25df637026ce3288880e5c587abd92/library/alloc/src/slice.rs:526:23:
capacity overflow
stack backtrace:
 0:     0x76bf9af5e4c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h791cca59c2eeee28
 1:     0x76bf9b6057f7 - core::fmt::write::h97a7af820072d676
 2:     0x76bf9c6e9cd1 - std::io::Write::write_fmt::h1245a83c9368b241
 3:     0x76bf9af5e322 - std::sys::backtrace::BacktraceLock::print::h7ac4e02696d52df5
 4:     0x76bf9af61f1a - std::panicking::default_hook::{{closure}}::h8eb31dccbdecdf8a
 5:     0x76bf9af61a9f - std::panicking::default_hook::h91e0d8dc8f06c0a3
 6:     0x76bf99f89c83 - std[4968f2f03965d2e2]::panicking::update_hook::<alloc[f94e5fe99def039a]::boxed::Box<rustc_driver_impl[7dbfdb670cae9b1b]::install_ice_hook::{closure#1}>>::{closure#0}
 7:     0x76bf9af62793 - std::panicking::rust_panic_with_hook::h361c0cc0b5542574
 8:     0x76bf9af62456 - std::panicking::begin_panic_handler::{{closure}}::hc4fbc10250e9e65d
 9:     0x76bf9af5e999 - std::sys::backtrace::__rust_end_short_backtrace::hc3ffdf64e78c2fbe
10:     0x76bf9af6214d - __rustc[ed2da27af75a8cb8]::rust_begin_unwind
11:     0x76bf97888de0 - core::panicking::panic_fmt::hf0c30228c7d5a750
12:     0x76bf998a6947 - alloc::raw_vec::capacity_overflow::h8c74285fe1fcff9f
13:     0x76bf982665c8 - alloc::raw_vec::handle_error::h56641488c4dc6875
14:     0x5c0a477834b5 - <[u8]>::repeat
15:     0x5c0a478fca20 - clippy_lints[9e6580e5641beb39]::matches::single_match::report_single_pattern
16:     0x5c0a47902691 - <clippy_lints[9e6580e5641beb39]::matches::Matches as rustc_lint[1700010031df97e0]::passes::LateLintPass>::check_expr
17:     0x76bf9a509f8e - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}
18:     0x76bf9a509ef7 - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_expr
19:     0x76bf9a50b2bb - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_block
20:     0x76bf9a50a657 - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}
21:     0x76bf9a509ef7 - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_expr
22:     0x76bf9a509d32 - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_nested_body
23:     0x76bf9a50a99e - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_fn
24:     0x76bf9a4f0da4 - <rustc_lint[1700010031df97e0]::late::LateContextAndPass<rustc_lint[1700010031df97e0]::late::RuntimeCombinedLateLintPass> as rustc_hir[a547d88e99cff5ba]::intravisit::Visitor>::visit_nested_item
25:     0x76bf9c4defde - rustc_lint[1700010031df97e0]::late::check_crate::{closure#0}
26:     0x76bf9c4df289 - rustc_lint[1700010031df97e0]::late::check_crate
27:     0x76bf9c4e2bdf - rustc_interface[1a7f6db5e55683ee]::passes::analysis
28:     0x76bf9c4e29b5 - rustc_query_impl[8d9b4f0db2c9623]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[8d9b4f0db2c9623]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d8138b7bea7b651b]::query::erase::Erased<[u8; 0usize]>>
29:     0x76bf9c4e4aba - rustc_query_system[eaf5d02d08bb0d89]::query::plumbing::try_execute_query::<rustc_query_impl[8d9b4f0db2c9623]::DynamicConfig<rustc_query_system[eaf5d02d08bb0d89]::query::caches::SingleCache<rustc_middle[d8138b7bea7b651b]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[8d9b4f0db2c9623]::plumbing::QueryCtxt, false>
30:     0x76bf9c4e478f - rustc_query_impl[8d9b4f0db2c9623]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
31:     0x76bf9c7b3807 - rustc_interface[1a7f6db5e55683ee]::passes::create_and_enter_global_ctxt::<core[2747f52fe7825488]::option::Option<rustc_interface[1a7f6db5e55683ee]::queries::Linker>, rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
32:     0x76bf9c6f50cf - rustc_interface[1a7f6db5e55683ee]::interface::run_compiler::<(), rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}>::{closure#1}
33:     0x76bf9c6b23c6 - std[4968f2f03965d2e2]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_with_globals<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_pool_with_globals<rustc_interface[1a7f6db5e55683ee]::interface::run_compiler<(), rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
34:     0x76bf9c6b206b - <<std[4968f2f03965d2e2]::thread::Builder>::spawn_unchecked_<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_with_globals<rustc_interface[1a7f6db5e55683ee]::util::run_in_thread_pool_with_globals<rustc_interface[1a7f6db5e55683ee]::interface::run_compiler<(), rustc_driver_impl[7dbfdb670cae9b1b]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[2747f52fe7825488]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
35:     0x76bf9c6b33bd - std::sys::pal::unix::thread::Thread::new::thread_start::h580e41b37d177b5f
36:     0x76bf964787eb - <unknown>
37:     0x76bf964fc18c - <unknown>
38:                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: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2025-05-24T07_16_50-915464.txt` to your bug report

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.89 (2eef47813f 2025-05-22)

warning: 1 warning emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions