Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: impl_trait_in_params.rs index out of bounds: the len is 0 but the index is 0 #11803

Closed
matthiaskrgr opened this issue Nov 14, 2023 · 0 comments · Fixed by #11804
Closed
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

Summary

pub trait Tr {
    fn f(&self, _x: impl std::fmt::Debug);
}

pub const fn g<T: IntoIterator<Item = impl Iterator<Item = impl Clone>>>() {
    extern "C" fn implementation_detail() {}
}

pub fn main() {}

Version

rustc 1.76.0-nightly (ba7c7a301 2023-11-13)
binary: rustc
commit-hash: ba7c7a301984967c8c13adb580ef9b86ba706a83
commit-date: 2023-11-13
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.4

Error output

Backtrace

warning: function `implementation_detail` is never used
--> 13D48CD41F5A579A5435E7F9C4FE8065532286F3ACCF4ABA19EF11AF1485BA41.rs:6:19
|
6 |     extern "C" fn implementation_detail() {}
|                   ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at src/tools/clippy/clippy_lints/src/functions/impl_trait_in_params.rs:62:56:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
 0:     0x7f261e18b61c - std::backtrace_rs::backtrace::libunwind::trace::hde577349c76cce7f
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
 1:     0x7f261e18b61c - std::backtrace_rs::backtrace::trace_unsynchronized::h9b71754079dc3035
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7f261e18b61c - std::sys_common::backtrace::_print_fmt::hb33349ab29b20866
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/sys_common/backtrace.rs:67:5
 3:     0x7f261e18b61c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbc5b9509b803594e
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/sys_common/backtrace.rs:44:22
 4:     0x7f261e1de620 - core::fmt::rt::Argument::fmt::h33b657cf79c72a38
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/core/src/fmt/rt.rs:142:9
 5:     0x7f261e1de620 - core::fmt::write::h2084c637086086bf
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/core/src/fmt/mod.rs:1120:17
 6:     0x7f261e17f53f - std::io::Write::write_fmt::h98ebe433443fcce9
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/io/mod.rs:1762:15
 7:     0x7f261e18b404 - std::sys_common::backtrace::_print::h15f76b394abd2e8f
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/sys_common/backtrace.rs:47:5
 8:     0x7f261e18b404 - std::sys_common::backtrace::print::h481d1b21ddf00e0c
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/sys_common/backtrace.rs:34:9
 9:     0x7f261e18e097 - std::panicking::default_hook::{{closure}}::hd3d3c641e5c130c3
10:     0x7f261e18ddff - std::panicking::default_hook::h7bca2f08153ccf97
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/panicking.rs:292:9
11:     0x7f2620eed050 - std[70c331c52e792e77]::panicking::update_hook::<alloc[ac42baf6c7d94bfa]::boxed::Box<rustc_driver_impl[662ed899c4750396]::install_ice_hook::{closure#0}>>::{closure#0}
12:     0x7f261e18e7d8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h01a2b076b44e44f8
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/alloc/src/boxed.rs:2021:9
13:     0x7f261e18e7d8 - std::panicking::rust_panic_with_hook::h24b0c40fd36c8eee
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/panicking.rs:783:13
14:     0x7f261e18e52e - std::panicking::begin_panic_handler::{{closure}}::hf0b52c49926ec9f4
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/panicking.rs:657:13
15:     0x7f261e18bae6 - std::sys_common::backtrace::__rust_end_short_backtrace::h7112d64e85585c9d
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/sys_common/backtrace.rs:170:18
16:     0x7f261e18e292 - rust_begin_unwind
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/panicking.rs:645:5
17:     0x7f261e1dad05 - core::panicking::panic_fmt::h2c71ea7e0c1376d6
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/core/src/panicking.rs:72:14
18:     0x7f261e1daf22 - core::panicking::panic_bounds_check::h8ec866ccff4594c8
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/core/src/panicking.rs:190:5
19:     0x560dec5e5465 - <clippy_lints[880b205496813fba]::functions::Functions as rustc_lint[af10f8c98ce8832b]::passes::LateLintPass>::check_fn
20:     0x7f2621295965 - <rustc_lint[af10f8c98ce8832b]::late::LateContextAndPass<rustc_lint[af10f8c98ce8832b]::late::RuntimeCombinedLateLintPass> as rustc_hir[ce20da1fc47864e6]::intravisit::Visitor>::visit_fn
21:     0x7f2621294085 - <rustc_lint[af10f8c98ce8832b]::late::LateContextAndPass<rustc_lint[af10f8c98ce8832b]::late::RuntimeCombinedLateLintPass> as rustc_hir[ce20da1fc47864e6]::intravisit::Visitor>::visit_item
22:     0x7f2621295d0a - <rustc_lint[af10f8c98ce8832b]::late::LateContextAndPass<rustc_lint[af10f8c98ce8832b]::late::RuntimeCombinedLateLintPass> as rustc_hir[ce20da1fc47864e6]::intravisit::Visitor>::visit_mod
23:     0x7f2622bf3fa7 - rustc_lint[af10f8c98ce8832b]::late::check_crate::{closure#0}
24:     0x7f2622bf41fa - rustc_lint[af10f8c98ce8832b]::late::check_crate
25:     0x7f262255cb17 - rustc_interface[7bd5efb410cadaba]::passes::analysis
26:     0x7f262255bbb7 - rustc_query_impl[6e3ec7c8d4ef4986]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[6e3ec7c8d4ef4986]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[991180616cb4918b]::query::erase::Erased<[u8; 1usize]>>
27:     0x7f2623199064 - rustc_query_system[16adaf3b80342c]::query::plumbing::try_execute_query::<rustc_query_impl[6e3ec7c8d4ef4986]::DynamicConfig<rustc_query_system[16adaf3b80342c]::query::caches::SingleCache<rustc_middle[991180616cb4918b]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[6e3ec7c8d4ef4986]::plumbing::QueryCtxt, false>
28:     0x7f2623198e55 - rustc_query_impl[6e3ec7c8d4ef4986]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
29:     0x7f26231a1a7f - rustc_interface[7bd5efb410cadaba]::interface::run_compiler::<core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>, rustc_driver_impl[662ed899c4750396]::run_compiler::{closure#1}>::{closure#0}
30:     0x7f26231a8d99 - std[70c331c52e792e77]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7bd5efb410cadaba]::util::run_in_thread_with_globals<rustc_interface[7bd5efb410cadaba]::util::run_in_thread_pool_with_globals<rustc_interface[7bd5efb410cadaba]::interface::run_compiler<core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>, rustc_driver_impl[662ed899c4750396]::run_compiler::{closure#1}>::{closure#0}, core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>>::{closure#0}, core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>>
31:     0x7f26231a8bc3 - <<std[70c331c52e792e77]::thread::Builder>::spawn_unchecked_<rustc_interface[7bd5efb410cadaba]::util::run_in_thread_with_globals<rustc_interface[7bd5efb410cadaba]::util::run_in_thread_pool_with_globals<rustc_interface[7bd5efb410cadaba]::interface::run_compiler<core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>, rustc_driver_impl[662ed899c4750396]::run_compiler::{closure#1}>::{closure#0}, core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>>::{closure#0}, core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4823536d104e8f97]::result::Result<(), rustc_span[43b04719702b35f]::ErrorGuaranteed>>::{closure#1} as core[4823536d104e8f97]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
32:     0x7f261e198695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hee7d8415653916ee
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/alloc/src/boxed.rs:2007:9
33:     0x7f261e198695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf8af5df67977eb57
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/alloc/src/boxed.rs:2007:9
34:     0x7f261e198695 - std::sys::unix::thread::Thread::new::thread_start::hc878850cbd82a8f9
                             at /rustc/ba7c7a301984967c8c13adb580ef9b86ba706a83/library/std/src/sys/unix/thread.rs:108:17
35:     0x7f261de9c9eb - <unknown>
36:     0x7f261df207cc - <unknown>
37:                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/icemaker/rustc-ice-2023-11-14T05_58_05-2645708.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.75 (ba7c7a3 2023-11-13)

warning: 1 warning emitted

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Nov 14, 2023
@matthiaskrgr matthiaskrgr changed the title ICE: impl_trait_in_params.rs `index out of bounds: the len is 0 but the index is 0 ICE: impl_trait_in_params.rs index out of bounds: the len is 0 but the index is 0 Nov 14, 2023
@bors bors closed this as completed in 783b914 Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
1 participant