Skip to content

ICE: clippy: entered unreachable code: expr must be an array or slice due to ExprKind::Array #121477

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

struct Foo(isize, isize, isize, isize);

pub fn main() {
    let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5);
    match [5, 5, 5, 5] {
        [..] => { }
    }
}

Meta

rustc --version --verbose:

clippy 0.1.78 (f62f490 2024-02-22)

rustc 1.78.0-nightly (f62f490fd 2024-02-22)
binary: rustc
commit-hash: f62f490fd410c06031a57915b4e5580ccbd7a30f
commit-date: 2024-02-22
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Error output

warning: fields `0`, `1`, `2`, and `3` are never read
 --> a.rs:2:12
  |
2 | struct Foo(isize, isize, isize, isize);
  |        --- ^^^^^  ^^^^^  ^^^^^  ^^^^^
  |        |
  |        fields in this struct
  |
  = note: `#[warn(dead_code)]` on by default
help: consider changing the fields to be of unit type to suppress this warning while preserving the field numbering, or remove the fields
  |
2 | struct Foo((), (), (), ());
  |            ~~  ~~  ~~  ~~
Backtrace

thread 'rustc' panicked at src/tools/clippy/clippy_lints/src/tuple_array_conversions.rs:68:9:
internal error: entered unreachable code: `expr` must be an array or slice due to `ExprKind::Array`
stack backtrace:
   0:     0x7f3bd538caf6 - std::backtrace_rs::backtrace::libunwind::trace::h4fc804798bc2611b
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f3bd538caf6 - std::backtrace_rs::backtrace::trace_unsynchronized::hd4bd33e8c8272882
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3bd538caf6 - std::sys_common::backtrace::_print_fmt::h545c234117c22fc9
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f3bd538caf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7a473c1b58fe7e10
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f3bd53dda7c - core::fmt::rt::Argument::fmt::h36d6352937d87a88
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/core/src/fmt/rt.rs:142:9
   5:     0x7f3bd53dda7c - core::fmt::write::h9c73f4067236af99
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f3bd53814bf - std::io::Write::write_fmt::hcc9c8f66fb450b80
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/io/mod.rs:1846:15
   7:     0x7f3bd538c8a4 - std::sys_common::backtrace::_print::h4e88c1e97f0d4518
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f3bd538c8a4 - std::sys_common::backtrace::print::h92dce13ce44b3a91
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f3bd538f5eb - std::panicking::default_hook::{{closure}}::h2c5fd0429c678c6f
  10:     0x7f3bd538f339 - std::panicking::default_hook::ha5d30dbe4da7a79b
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/panicking.rs:292:9
  11:     0x7f3bd8271c7c - std[821c6b3b8c530c40]::panicking::update_hook::<alloc[8ac6b170fd61b1e2]::boxed::Box<rustc_driver_impl[59d1908ab5d44cab]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f3bd538fd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hcaa5eb95c84b3711
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/alloc/src/boxed.rs:2030:9
  13:     0x7f3bd538fd50 - std::panicking::rust_panic_with_hook::h0d9771b9524e7484
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/panicking.rs:786:13
  14:     0x7f3bd538fa59 - std::panicking::begin_panic_handler::{{closure}}::hbcb115fc368d9d99
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/panicking.rs:652:13
  15:     0x7f3bd538cfd6 - std::sys_common::backtrace::__rust_end_short_backtrace::h43dd1fced9908690
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f3bd538f7c4 - rust_begin_unwind
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/panicking.rs:648:5
  17:     0x7f3bd53d9f95 - core::panicking::panic_fmt::hd4728c4b0ec637f4
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/core/src/panicking.rs:72:14
  18:     0x563c0c9cc504 - <clippy_lints[ceaf82ba4fb68b51]::tuple_array_conversions::TupleArrayConversions as rustc_lint[4f8e23604aba8bf8]::passes::LateLintPass>::check_expr
  19:     0x7f3bd85f8fb2 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_expr::{closure#0}
  20:     0x7f3bd85f8e48 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_expr
  21:     0x7f3bd85f91f2 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_expr::{closure#0}
  22:     0x7f3bd85f8e48 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_expr
  23:     0x7f3bd85f9ebf - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_block
  24:     0x7f3bd85f9454 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_expr::{closure#0}
  25:     0x7f3bd85f8e48 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_expr
  26:     0x7f3bd85f8d48 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_nested_body
  27:     0x7f3bd85f9a04 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_fn
  28:     0x7f3bd85e8e04 - <rustc_lint[4f8e23604aba8bf8]::late::LateContextAndPass<rustc_lint[4f8e23604aba8bf8]::late::RuntimeCombinedLateLintPass> as rustc_hir[d91d3a3bd337c424]::intravisit::Visitor>::visit_nested_item
  29:     0x7f3bda1a1e7d - rustc_lint[4f8e23604aba8bf8]::late::check_crate::{closure#0}
  30:     0x7f3bda1a20d1 - rustc_lint[4f8e23604aba8bf8]::late::check_crate
  31:     0x7f3bda19bfe5 - rustc_interface[8734248df239def8]::passes::analysis
  32:     0x7f3bda19acd9 - rustc_query_impl[ecde01aee8afea7b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ecde01aee8afea7b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2eacc124c30f1755]::query::erase::Erased<[u8; 1usize]>>
  33:     0x7f3bda336f65 - rustc_query_system[e0ca4a2ac3d1a2c5]::query::plumbing::try_execute_query::<rustc_query_impl[ecde01aee8afea7b]::DynamicConfig<rustc_query_system[e0ca4a2ac3d1a2c5]::query::caches::SingleCache<rustc_middle[2eacc124c30f1755]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ecde01aee8afea7b]::plumbing::QueryCtxt, false>
  34:     0x7f3bda336cc9 - rustc_query_impl[ecde01aee8afea7b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f3bda346196 - rustc_interface[8734248df239def8]::interface::run_compiler::<core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>, rustc_driver_impl[59d1908ab5d44cab]::run_compiler::{closure#0}>::{closure#0}
  36:     0x7f3bda5c2dcd - std[821c6b3b8c530c40]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8734248df239def8]::util::run_in_thread_with_globals<rustc_interface[8734248df239def8]::util::run_in_thread_pool_with_globals<rustc_interface[8734248df239def8]::interface::run_compiler<core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>, rustc_driver_impl[59d1908ab5d44cab]::run_compiler::{closure#0}>::{closure#0}, core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>>::{closure#0}, core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>>
  37:     0x7f3bda5c2bfa - <<std[821c6b3b8c530c40]::thread::Builder>::spawn_unchecked_<rustc_interface[8734248df239def8]::util::run_in_thread_with_globals<rustc_interface[8734248df239def8]::util::run_in_thread_pool_with_globals<rustc_interface[8734248df239def8]::interface::run_compiler<core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>, rustc_driver_impl[59d1908ab5d44cab]::run_compiler::{closure#0}>::{closure#0}, core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>>::{closure#0}, core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[256ba93ffbc6f60f]::result::Result<(), rustc_span[503fa18317341f7e]::ErrorGuaranteed>>::{closure#1} as core[256ba93ffbc6f60f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7f3bd5399725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h707c303233e58066
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/alloc/src/boxed.rs:2016:9
  39:     0x7f3bd5399725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3bccdf5582e5652c
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/alloc/src/boxed.rs:2016:9
  40:     0x7f3bd5399725 - std::sys::pal::unix::thread::Thread::new::thread_start::h279bb1ec141bc5eb
                               at /rustc/f62f490fd410c06031a57915b4e5580ccbd7a30f/library/std/src/sys/pal/unix/thread.rs:108:17
  41:     0x7f3bd50949eb - <unknown>
  42:     0x7f3bd51187cc - <unknown>
  43:                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 attach the file at `/tmp/im/rustc-ice-2024-02-22T19_49_41-1815680.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.78 (f62f490 2024-02-22)

error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
 --> a.rs:5:9
  |
5 |     let Self::anything_here_kills_it(a, b, ..) = Foo(5, 5, 5, 5);
  |         ^^^^ `Self` is only available in impls, traits, and type definitions

error: aborting due to 1 previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0433`.

Metadata

Metadata

Assignees

Labels

A-clippyArea: ClippyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions