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: index_slicing TryFromIntError(()) #12253

Closed
matthiaskrgr opened this issue Feb 9, 2024 · 0 comments · Fixed by #12266
Closed

ICE: index_slicing TryFromIntError(()) #12253

matthiaskrgr opened this issue Feb 9, 2024 · 0 comments · Fixed by #12266
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

const C: [u32; 5] = [0; 5];

#[allow(unconditional_panic)]
fn test() -> u32 {
    C[0xfffffe7fffffffffffffffffffffffff]
}

fn main() {
    test();
}

Version

rustc 1.78.0-nightly (98aa3624b 2024-02-08)
binary: rustc
commit-hash: 98aa3624be70462d6a25ed5544333e3df62f4c66
commit-date: 2024-02-08
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

Error output

Backtrace

✦ at 23:46:43 ❯ clippy-driver 11881CD2408DECF1D508DAB0E3A39CFF4BB5B273EB5D648D218A389B3FD6862D.rs
thread 'rustc' panicked at src/tools/clippy/clippy_lints/src/indexing_slicing.rs:183:60:
called `Result::unwrap()` on an `Err` value: TryFromIntError(())
stack backtrace:
 0:     0x7f9d1482ddd6 - std::backtrace_rs::backtrace::libunwind::trace::hcf4842620364d535
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
 1:     0x7f9d1482ddd6 - std::backtrace_rs::backtrace::trace_unsynchronized::h615a7d3c4b72d07a
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7f9d1482ddd6 - std::sys_common::backtrace::_print_fmt::h777946980bbce9d4
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:68:5
 3:     0x7f9d1482ddd6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0fdadf67cf82c3e5
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:44:22
 4:     0x7f9d14880830 - core::fmt::rt::Argument::fmt::h40bec717748a6a66
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/core/src/fmt/rt.rs:142:9
 5:     0x7f9d14880830 - core::fmt::write::hfb3923fb2f513fc0
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/core/src/fmt/mod.rs:1120:17
 6:     0x7f9d1482164f - std::io::Write::write_fmt::h7dd8ba1b7fdc9479
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/io/mod.rs:1854:15
 7:     0x7f9d1482dbb4 - std::sys_common::backtrace::_print::hffce9865d8ccd857
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:47:5
 8:     0x7f9d1482dbb4 - std::sys_common::backtrace::print::h532d3566cc4254d4
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:34:9
 9:     0x7f9d14830947 - std::panicking::default_hook::{{closure}}::hfa7000b32c4e888b
10:     0x7f9d148306a9 - std::panicking::default_hook::haaf1b4b762fde1ac
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/panicking.rs:292:9
11:     0x7f9d1153b78c - std[5c40b41967587ec6]::panicking::update_hook::<alloc[5d4b954b8b3d7648]::boxed::Box<rustc_driver_impl[ab5bb327712dbf0b]::install_ice_hook::{closure#0}>>::{closure#0}
12:     0x7f9d14831096 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4c230f69fdc2df31
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/alloc/src/boxed.rs:2029:9
13:     0x7f9d14831096 - std::panicking::rust_panic_with_hook::h89e8d9a00153591c
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/panicking.rs:785:13
14:     0x7f9d14830de2 - std::panicking::begin_panic_handler::{{closure}}::h0fe7a7a11cf6b670
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/panicking.rs:659:13
15:     0x7f9d1482e2d6 - std::sys_common::backtrace::__rust_end_short_backtrace::h5875974741c16bab
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys_common/backtrace.rs:171:18
16:     0x7f9d14830b34 - rust_begin_unwind
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/panicking.rs:647:5
17:     0x7f9d1487cf35 - core::panicking::panic_fmt::h58288a9f4ffa83be
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/core/src/panicking.rs:72:14
18:     0x7f9d1487d633 - core::result::unwrap_failed::hc4dc3d75b9b6c2d2
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/core/src/result.rs:1649:5
19:     0x5576cdae5d60 - <clippy_lints[4adc89ef7e50f8ef]::indexing_slicing::IndexingSlicing as rustc_lint[ad3a80d67f2621aa]::passes::LateLintPass>::check_expr
20:     0x7f9d118b28a3 - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_expr::{closure#0}
21:     0x7f9d118b2738 - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_expr
22:     0x7f9d118b3b1f - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_block
23:     0x7f9d118b2f71 - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_expr::{closure#0}
24:     0x7f9d118b2738 - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_expr
25:     0x7f9d118b101a - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_nested_body
26:     0x7f9d118b3304 - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_fn
27:     0x7f9d118b185f - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_item
28:     0x7f9d118b363a - <rustc_lint[ad3a80d67f2621aa]::late::LateContextAndPass<rustc_lint[ad3a80d67f2621aa]::late::RuntimeCombinedLateLintPass> as rustc_hir[b9801340eb4e9761]::intravisit::Visitor>::visit_mod
29:     0x7f9d13361527 - rustc_lint[ad3a80d67f2621aa]::late::check_crate::{closure#0}
30:     0x7f9d13361775 - rustc_lint[ad3a80d67f2621aa]::late::check_crate
31:     0x7f9d13163ce8 - rustc_interface[f5c5c4389ec3cf3a]::passes::analysis
32:     0x7f9d131629df - rustc_query_impl[99ac65c25f06845a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[99ac65c25f06845a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d2b54ada19c9e5f1]::query::erase::Erased<[u8; 1usize]>>
33:     0x7f9d1350a5b2 - rustc_query_system[98dc65aab34f8a4c]::query::plumbing::try_execute_query::<rustc_query_impl[99ac65c25f06845a]::DynamicConfig<rustc_query_system[98dc65aab34f8a4c]::query::caches::SingleCache<rustc_middle[d2b54ada19c9e5f1]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[99ac65c25f06845a]::plumbing::QueryCtxt, false>
34:     0x7f9d1350a315 - rustc_query_impl[99ac65c25f06845a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
35:     0x7f9d135173f6 - rustc_interface[f5c5c4389ec3cf3a]::interface::run_compiler::<core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>, rustc_driver_impl[ab5bb327712dbf0b]::run_compiler::{closure#0}>::{closure#0}
36:     0x7f9d131a9386 - std[5c40b41967587ec6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_with_globals<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_pool_with_globals<rustc_interface[f5c5c4389ec3cf3a]::interface::run_compiler<core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>, rustc_driver_impl[ab5bb327712dbf0b]::run_compiler::{closure#0}>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>
37:     0x7f9d131a91b3 - <<std[5c40b41967587ec6]::thread::Builder>::spawn_unchecked_<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_with_globals<rustc_interface[f5c5c4389ec3cf3a]::util::run_in_thread_pool_with_globals<rustc_interface[f5c5c4389ec3cf3a]::interface::run_compiler<core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>, rustc_driver_impl[ab5bb327712dbf0b]::run_compiler::{closure#0}>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2f2a284c56ca7af5]::result::Result<(), rustc_span[e69a7bbb34a31e54]::ErrorGuaranteed>>::{closure#1} as core[2f2a284c56ca7af5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
38:     0x7f9d1483a735 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd35908ec403131f0
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/alloc/src/boxed.rs:2015:9
39:     0x7f9d1483a735 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6d654616ee0757b9
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/alloc/src/boxed.rs:2015:9
40:     0x7f9d1483a735 - std::sys::pal::unix::thread::Thread::new::thread_start::h987e3b25a01ed571
                             at /rustc/98aa3624be70462d6a25ed5544333e3df62f4c66/library/std/src/sys/pal/unix/thread.rs:108:17
41:     0x7f9d0e5bd9eb - <unknown>
42:     0x7f9d0e6417cc - <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-09T22_46_47-2955040.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.77 (98aa362 2024-02-08)

error: literal out of range for `usize`
--> 11881CD2408DECF1D508DAB0E3A39CFF4BB5B273EB5D648D218A389B3FD6862D.rs:9:7
|
9 |     C[0xfffffe7fffffffffffffffffffffffff]
|       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the literal `0xfffffe7fffffffffffffffffffffffff` (decimal `340282336497324057985868971510891282431`) does not fit into the type `usize` and will become `18446744073709551615usize`
= note: `#[deny(overflowing_literals)]` on by default

error: aborting due to 1 previous error

@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 Feb 9, 2024
@bors bors closed this as completed in 7dfa6ce Feb 12, 2024
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
Development

Successfully merging a pull request may close this issue.

1 participant