Skip to content

index out of bounds: panicked at iter_filter.rs:26:26 #12058

@cdump

Description

@cdump

Summary

Steps to reproduce

Clone foundry-rs:

$ git clone https://github.com/foundry-rs/foundry
$ cd foundry
$ git checkout 6d7cceafdcbdb5e48c128a5b32cb7267498f4674 # reproduced on this commit
$ cd crates/config/ 

Clippy release works:

$ cargo clippy --version
clippy 0.1.74 (a28077b 2023-12-04)

$ cargo clippy --all-features
..
    Finished dev [unoptimized] target(s) in 1m 28s

Clippy nightly fails:

$ cargo +nightly clippy --version 
clippy 0.1.77 (3cdd004 2023-12-29)

$ cargo +nightly clippy --all-features
...
error: the compiler unexpectedly panicked. this is a bug.

rustc-ice-2023-12-30T13_12_06-149084.txt

Version

$ rustc +nightly -Vv

rustc 1.77.0-nightly (3cdd004e5 2023-12-29)
binary: rustc
commit-hash: 3cdd004e55c869faa2b7b25efd3becf50346e7d6
commit-date: 2023-12-29
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Error output

Backtrace

thread 'rustc' panicked at src/tools/clippy/clippy_lints/src/methods/iter_filter.rs:26:26:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
 0:     0x7f75af3ec756 - std::backtrace_rs::backtrace::libunwind::trace::h94f8c7122e05c230
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
 1:     0x7f75af3ec756 - std::backtrace_rs::backtrace::trace_unsynchronized::h449cc397f38f961a
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7f75af3ec756 - std::sys_common::backtrace::_print_fmt::h99e89bb2cec7ce30
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/sys_common/backtrace.rs:68:5
 3:     0x7f75af3ec756 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9d5ec8eb2e1a7700
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/sys_common/backtrace.rs:44:22
 4:     0x7f75af43f080 - core::fmt::rt::Argument::fmt::h7ef4d083260a0351
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/core/src/fmt/rt.rs:142:9
 5:     0x7f75af43f080 - core::fmt::write::h2a403cc736abb76d
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/core/src/fmt/mod.rs:1120:17
 6:     0x7f75af3e049f - std::io::Write::write_fmt::h9388093ce47d738a
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/io/mod.rs:1810:15
 7:     0x7f75af3ec534 - std::sys_common::backtrace::_print::he4265a9234d5139f
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/sys_common/backtrace.rs:47:5
 8:     0x7f75af3ec534 - std::sys_common::backtrace::print::h5cc27ab6a8643bdb
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/sys_common/backtrace.rs:34:9
 9:     0x7f75af3ef2c7 - std::panicking::default_hook::{{closure}}::hc8257eee467fd46c
10:     0x7f75af3ef029 - std::panicking::default_hook::hff02dc68ee5d3c46
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/panicking.rs:292:9
11:     0x7f75ac15106c - std[bce8a3935be9b497]::panicking::update_hook::<alloc[55b8802719acf2f0]::boxed::Box<rustc_driver_impl[e32ff1f67578002d]::install_ice_hook::{closure#0}>>::{closure#0}
12:     0x7f75af3efa16 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h36f3347658e0b917
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/alloc/src/boxed.rs:2029:9
13:     0x7f75af3efa16 - std::panicking::rust_panic_with_hook::hca2e28235e9b1d5c
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/panicking.rs:783:13
14:     0x7f75af3ef762 - std::panicking::begin_panic_handler::{{closure}}::h12fe0f3c055c0d25
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/panicking.rs:657:13
15:     0x7f75af3ecc56 - std::sys_common::backtrace::__rust_end_short_backtrace::hac29e2e1d1f10185
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/sys_common/backtrace.rs:171:18
16:     0x7f75af3ef4c0 - rust_begin_unwind
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/panicking.rs:645:5
17:     0x7f75af43b785 - core::panicking::panic_fmt::h72b9f790277cded1
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/core/src/panicking.rs:72:14
18:     0x7f75af43b9c2 - core::panicking::panic_bounds_check::h75d20a9f21c02e8d
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/core/src/panicking.rs:208:5
19:     0x55c356b29525 - clippy_lints[fd3787c0c5903b8]::methods::iter_filter::is_method
20:     0x55c356b2958e - clippy_lints[fd3787c0c5903b8]::methods::iter_filter::check
21:     0x55c356b4457e - <clippy_lints[fd3787c0c5903b8]::methods::Methods as rustc_lint[29c9bd602bfd6f83]::passes::LateLintPass>::check_expr
22:     0x7f75ac4e7a80 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr::{closure#0}
23:     0x7f75ac4e7908 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr
24:     0x7f75ac4e623a - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_nested_body
25:     0x7f75ac4e8474 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_fn
26:     0x7f75ac4e80bd - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr::{closure#0}
27:     0x7f75ac4e7908 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr
28:     0x7f75ac4e7cfe - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr::{closure#0}
29:     0x7f75ac4e7908 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr
30:     0x7f75ac4e8c8f - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_block
31:     0x7f75ac4e80d8 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr::{closure#0}
32:     0x7f75ac4e7908 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_expr
33:     0x7f75ac4e623a - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_nested_body
34:     0x7f75ac4e8474 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_fn
35:     0x7f75ac4e7302 - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_item
36:     0x7f75ac4e87aa - <rustc_lint[29c9bd602bfd6f83]::late::LateContextAndPass<rustc_lint[29c9bd602bfd6f83]::late::RuntimeCombinedLateLintPass> as rustc_hir[eea55af166e26e78]::intravisit::Visitor>::visit_mod
37:     0x7f75add28e26 - rustc_lint[29c9bd602bfd6f83]::late::check_crate::{closure#0}
38:     0x7f75add2907a - rustc_lint[29c9bd602bfd6f83]::late::check_crate
39:     0x7f75add22e82 - rustc_interface[6bc3f1fe26159ec6]::passes::analysis
40:     0x7f75add21c9d - rustc_query_impl[263a4c4803f5a481]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[263a4c4803f5a481]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[63b3e6726caca282]::query::erase::Erased<[u8; 1usize]>>
41:     0x7f75ae3a52cb - rustc_query_system[8a0cb62b01f6b7e7]::query::plumbing::try_execute_query::<rustc_query_impl[263a4c4803f5a481]::DynamicConfig<rustc_query_system[8a0cb62b01f6b7e7]::query::caches::SingleCache<rustc_middle[63b3e6726caca282]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[263a4c4803f5a481]::plumbing::QueryCtxt, true>
42:     0x7f75ae3a4f6a - rustc_query_impl[263a4c4803f5a481]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
43:     0x7f75ae4344de - rustc_interface[6bc3f1fe26159ec6]::interface::run_compiler::<core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>, rustc_driver_impl[e32ff1f67578002d]::run_compiler::{closure#0}>::{closure#0}
44:     0x7f75ae3b5706 - std[bce8a3935be9b497]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6bc3f1fe26159ec6]::util::run_in_thread_with_globals<rustc_interface[6bc3f1fe26159ec6]::util::run_in_thread_pool_with_globals<rustc_interface[6bc3f1fe26159ec6]::interface::run_compiler<core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>, rustc_driver_impl[e32ff1f67578002d]::run_compiler::{closure#0}>::{closure#0}, core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>>::{closure#0}, core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>>
45:     0x7f75ae3b5533 - <<std[bce8a3935be9b497]::thread::Builder>::spawn_unchecked_<rustc_interface[6bc3f1fe26159ec6]::util::run_in_thread_with_globals<rustc_interface[6bc3f1fe26159ec6]::util::run_in_thread_pool_with_globals<rustc_interface[6bc3f1fe26159ec6]::interface::run_compiler<core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>, rustc_driver_impl[e32ff1f67578002d]::run_compiler::{closure#0}>::{closure#0}, core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>>::{closure#0}, core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[428442fe84ea1b4e]::result::Result<(), rustc_span[16f9992e6c25b5e]::ErrorGuaranteed>>::{closure#1} as core[428442fe84ea1b4e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
46:     0x7f75af3f9945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h86a431238d49a3fd
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/alloc/src/boxed.rs:2015:9
47:     0x7f75af3f9945 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h45a4c3506ac8cdc6
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/alloc/src/boxed.rs:2015:9
48:     0x7f75af3f9945 - std::sys::unix::thread::Thread::new::thread_start::h42580b3c714a9afd
                             at /rustc/3cdd004e55c869faa2b7b25efd3becf50346e7d6/library/std/src/sys/unix/thread.rs:108:17
49:     0x7f75a91bd9eb - <unknown>
50:     0x7f75a92417cc - <unknown>
51:                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 `/home/user/repr/foundry/rustc-ice-2023-12-30T13_12_06-149084.txt` to your bug report

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

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

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.77 (3cdd004 2023-12-29)

error: could not compile `foundry-config` (lib)

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