Skip to content

Clippy failed when computing type #14828

Closed
@ajz34

Description

@ajz34

Summary

The compiler asks for bug report. I'm actually have no idea what the problem exactly is (couldn't give an MWE for this issue in this mean time).

This project is https://github.com/RESTGroup/rest , and the error raises at https://github.com/RESTGroup/rstsr/blob/2bd5ff9b20607dcc86c45f59e3a7c91761200eb9/rstsr-core/src/storage/data.rs#L175-L181 . However, when I extract this code (and essential dependent code for defining DataRef) out, clippy seems does not raise error.

I've already tried clear directory of target or debug or cargo clean, and this problem still exists.

This problem is first found in github action (https://github.com/RESTGroup/rstsr/actions/runs/15085408042/job/42407306863?pr=28).

I guess that clippy 0.1.88 does not raise such kind of error, but 0.1.89 shows error, since this problem does not exist yesterday.

ICE log file follows:
rustc-ice-2025-05-17T13_40_11-206567.txt

Version

rustc 1.89.0-nightly (16d2276fa 2025-05-16)
binary: rustc
commit-hash: 16d2276fa6fccb0cc239a542d4c3f0eb46f660ec
commit-date: 2025-05-16
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4

Error output

Backtrace

  Checking rstsr-native-impl v0.3.1 (/home/a/Git-Repo/rstsr/rstsr-native-impl)
  Checking rstsr-test-manifest v0.0.0 (/home/a/Git-Repo/rstsr/rstsr-test-manifest)
  Checking nano-gemm v0.1.2
  Checking faer v0.22.6
  Checking faer-ext v0.6.0
  Checking rstsr-core v0.3.1 (/home/a/Git-Repo/rstsr/rstsr-core)
error: internal compiler error: compiler/rustc_hir_analysis/src/collect/type_of.rs:264:17: compute_type_of_item: unexpected item type: Trait(No, Safe, DataAPI#0, Generics { params: [], predicates: [], has_where_clause_predicates: false, where_clause_span: rstsr-core/src/storage/data.rs:175:18: 175:18 (#0), span: rstsr-core/src/storage/data.rs:175:18: 175:18 (#0) }, [], [TraitItemRef { id: TraitItemId { owner_id: DefId(0:692 ~ rstsr_core[b2ce]::storage::data::DataAPI::Data) }, ident: Data#0, kind: Type, span: rstsr-core/src/storage/data.rs:176:5: 176:15 (#0) }, TraitItemRef { id: TraitItemId { owner_id: DefId(0:693 ~ rstsr_core[b2ce]::storage::data::DataAPI::raw) }, ident: raw#0, kind: Fn { has_self: true }, span: rstsr-core/src/storage/data.rs:177:5: 177:34 (#0) }, TraitItemRef { id: TraitItemId { owner_id: DefId(0:694 ~ rstsr_core[b2ce]::storage::data::DataAPI::as_ref) }, ident: as_ref#0, kind: Fn { has_self: true }, span: rstsr-core/src/storage/data.rs:178:5: 180:6 (#0) }])
 --> rstsr-core/src/storage/data.rs:175:1
  |
175 | / pub trait DataAPI {
176 | |     type Data;
177 | |     fn raw(&self) -> &Self::Data;
178 | |     fn as_ref(&self) -> DataRef<Self::Data> {
...   |
181 | | }
  | |_^


thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/type_of.rs:264:17:
Box<dyn Any>
stack backtrace:
 0:     0x72ef37b65b33 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h8ce760ad42a959df
 1:     0x72ef38205977 - core::fmt::write::h17deacb9d093717d
 2:     0x72ef3925bdd1 - std::io::Write::write_fmt::h8edc637e3ed34e58
 3:     0x72ef37b65992 - std::sys::backtrace::BacktraceLock::print::hf4e931b5b8f47af6
 4:     0x72ef37b6958a - std::panicking::default_hook::{{closure}}::h1aa602af6f79c655
 5:     0x72ef37b6910f - std::panicking::default_hook::hb6d5039bf2b4cecd
 6:     0x72ef36b94e13 - std[23b1014898398f3a]::panicking::update_hook::<alloc[189bd33173793ff9]::boxed::Box<rustc_driver_impl[c8796dbdb0a790d0]::install_ice_hook::{closure#1}>>::{closure#0}
 7:     0x72ef37b69e03 - std::panicking::rust_panic_with_hook::h1a38b2651d61b684
 8:     0x72ef36bd1281 - std[23b1014898398f3a]::panicking::begin_panic::<rustc_errors[84d6361680d21c4f]::ExplicitBug>::{closure#0}
 9:     0x72ef36bc5156 - std[23b1014898398f3a]::sys::backtrace::__rust_end_short_backtrace::<std[23b1014898398f3a]::panicking::begin_panic<rustc_errors[84d6361680d21c4f]::ExplicitBug>::{closure#0}, !>
10:     0x72ef36bc513b - std[23b1014898398f3a]::panicking::begin_panic::<rustc_errors[84d6361680d21c4f]::ExplicitBug>
11:     0x72ef36bdb9f1 - <rustc_errors[84d6361680d21c4f]::diagnostic::BugAbort as rustc_errors[84d6361680d21c4f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12:     0x72ef371acf7c - <rustc_errors[84d6361680d21c4f]::DiagCtxtHandle>::span_bug::<rustc_span[10508ddd74bd9d4e]::span_encoding::Span, alloc[189bd33173793ff9]::string::String>
13:     0x72ef3724a127 - rustc_middle[3cba1f9493d37f78]::util::bug::opt_span_bug_fmt::<rustc_span[10508ddd74bd9d4e]::span_encoding::Span>::{closure#0}
14:     0x72ef3722394a - rustc_middle[3cba1f9493d37f78]::ty::context::tls::with_opt::<rustc_middle[3cba1f9493d37f78]::util::bug::opt_span_bug_fmt<rustc_span[10508ddd74bd9d4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
15:     0x72ef372237bb - rustc_middle[3cba1f9493d37f78]::ty::context::tls::with_context_opt::<rustc_middle[3cba1f9493d37f78]::ty::context::tls::with_opt<rustc_middle[3cba1f9493d37f78]::util::bug::opt_span_bug_fmt<rustc_span[10508ddd74bd9d4e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
16:     0x72ef35d07427 - rustc_middle[3cba1f9493d37f78]::util::bug::span_bug_fmt::<rustc_span[10508ddd74bd9d4e]::span_encoding::Span>
17:     0x72ef385e941a - rustc_hir_analysis[2ff1991ffb30aa1a]::collect::type_of::type_of
18:     0x72ef385e38f6 - rustc_query_impl[efffa611636c8e5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[efffa611636c8e5b]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 8usize]>>
19:     0x72ef3853c13f - rustc_query_system[194713339954f907]::query::plumbing::try_execute_query::<rustc_query_impl[efffa611636c8e5b]::DynamicConfig<rustc_query_system[194713339954f907]::query::caches::DefIdCache<rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[efffa611636c8e5b]::plumbing::QueryCtxt, true>
20:     0x72ef38537f76 - rustc_query_impl[efffa611636c8e5b]::query_impl::type_of::get_query_incr::__rust_end_short_backtrace
21:     0x614c520610a5 - clippy_lints[4b4f8f832c32ff8e]::methods::useless_asref::check
22:     0x614c5206e298 - <clippy_lints[4b4f8f832c32ff8e]::methods::Methods>::check_methods
23:     0x614c520643ed - <clippy_lints[4b4f8f832c32ff8e]::methods::Methods as rustc_lint[cb3b75e5b7257328]::passes::LateLintPass>::check_expr
24:     0x72ef3711506e - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}
25:     0x72ef37114fd7 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr
26:     0x72ef371153f0 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}
27:     0x72ef37114fd7 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr
28:     0x72ef371156f2 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}
29:     0x72ef37114fd7 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr
30:     0x72ef3711639b - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_block
31:     0x72ef37115737 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr::{closure#0}::{closure#0}
32:     0x72ef37114fd7 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_expr
33:     0x72ef37114e12 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_nested_body
34:     0x72ef37115a7e - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_fn
35:     0x72ef370fd1f2 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_nested_item
36:     0x72ef370fc2c8 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_nested_item
37:     0x72ef370fc2c8 - <rustc_lint[cb3b75e5b7257328]::late::LateContextAndPass<rustc_lint[cb3b75e5b7257328]::late::RuntimeCombinedLateLintPass> as rustc_hir[a42fa6d2d64b4830]::intravisit::Visitor>::visit_nested_item
38:     0x72ef390f50b8 - rustc_lint[cb3b75e5b7257328]::late::check_crate::{closure#0}
39:     0x72ef390f536b - rustc_lint[cb3b75e5b7257328]::late::check_crate
40:     0x72ef390f8cdf - rustc_interface[88f95fb9e776d181]::passes::analysis
41:     0x72ef390f8ab5 - rustc_query_impl[efffa611636c8e5b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[efffa611636c8e5b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 0usize]>>
42:     0x72ef39444304 - rustc_query_system[194713339954f907]::query::plumbing::try_execute_query::<rustc_query_impl[efffa611636c8e5b]::DynamicConfig<rustc_query_system[194713339954f907]::query::caches::SingleCache<rustc_middle[3cba1f9493d37f78]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[efffa611636c8e5b]::plumbing::QueryCtxt, true>
43:     0x72ef39443c28 - rustc_query_impl[efffa611636c8e5b]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
44:     0x72ef39326607 - rustc_interface[88f95fb9e776d181]::passes::create_and_enter_global_ctxt::<core[64e60dbc053b37]::option::Option<rustc_interface[88f95fb9e776d181]::queries::Linker>, rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
45:     0x72ef39279ba6 - rustc_interface[88f95fb9e776d181]::interface::run_compiler::<(), rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}>::{closure#1}
46:     0x72ef392528be - std[23b1014898398f3a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[88f95fb9e776d181]::util::run_in_thread_with_globals<rustc_interface[88f95fb9e776d181]::util::run_in_thread_pool_with_globals<rustc_interface[88f95fb9e776d181]::interface::run_compiler<(), rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
47:     0x72ef39252d2b - <<std[23b1014898398f3a]::thread::Builder>::spawn_unchecked_<rustc_interface[88f95fb9e776d181]::util::run_in_thread_with_globals<rustc_interface[88f95fb9e776d181]::util::run_in_thread_pool_with_globals<rustc_interface[88f95fb9e776d181]::interface::run_compiler<(), rustc_driver_impl[c8796dbdb0a790d0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[64e60dbc053b37]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
48:     0x72ef3925412b - std::sys::pal::unix::thread::Thread::new::thread_start::ha2537cf437130d92
49:     0x72ef32e94ac3 - start_thread
                             at ./nptl/pthread_create.c:442:8
50:     0x72ef32f26850 - __GI___clone3
                             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0
51:                0x0 - <unknown>

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/a/Git-Repo/rstsr/rustc-ice-2025-05-17T13_40_11-206567.txt` to your bug report

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -C link-arg=-fuse-ld=lld

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

query stack during panic:
#0 [type_of] computing type of `storage::data::DataAPI`
#1 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.89 (16d2276fa6 2025-05-16)

error: could not compile `rstsr-core` (lib)

Caused by:
process didn't exit successfully: `/home/a/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/clippy-driver /home/a/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name rstsr_core --edition=2021 rstsr-core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=238 --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="aligned_alloc"' --cfg 'feature="default"' --cfg 'feature="faer"' --cfg 'feature="faer_as_default"' --cfg 'feature="rayon"' --cfg 'feature="row_major"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("aligned_alloc", "col_major", "default", "dispatch_dim_layout_iter", "faer", "faer_as_default", "rayon", "row_major", "std"))' -C metadata=acf4f3e0ecfb2c25 -C extra-filename=-99688acecdf94299 --out-dir /home/a/Git-Repo/rstsr/target/debug/deps -C incremental=/home/a/Git-Repo/rstsr/target/debug/incremental -L dependency=/home/a/Git-Repo/rstsr/target/debug/deps --extern derive_builder=/home/a/Git-Repo/rstsr/target/debug/deps/libderive_builder-f899293ac6d79782.rmeta --extern duplicate=/home/a/Git-Repo/rstsr/target/debug/deps/libduplicate-31104c9f79dbf127.so --extern faer=/home/a/Git-Repo/rstsr/target/debug/deps/libfaer-7414fe8acbbde630.rmeta --extern faer_ext=/home/a/Git-Repo/rstsr/target/debug/deps/libfaer_ext-e1bc5d6946610bdc.rmeta --extern half=/home/a/Git-Repo/rstsr/target/debug/deps/libhalf-958f1c8e68091c09.rmeta --extern itertools=/home/a/Git-Repo/rstsr/target/debug/deps/libitertools-dfec36d8ecac7af8.rmeta --extern num=/home/a/Git-Repo/rstsr/target/debug/deps/libnum-8a98fb8b5a67f8f0.rmeta --extern rayon=/home/a/Git-Repo/rstsr/target/debug/deps/librayon-06d923b4574ee7b4.rmeta --extern rstsr_common=/home/a/Git-Repo/rstsr/target/debug/deps/librstsr_common-914e3294d2153dd7.rmeta --extern rstsr_dtype_traits=/home/a/Git-Repo/rstsr/target/debug/deps/librstsr_dtype_traits-907406049fd49bb6.rmeta --extern rstsr_native_impl=/home/a/Git-Repo/rstsr/target/debug/deps/librstsr_native_impl-57215ed91ccab560.rmeta -C link-arg=-fuse-ld=lld` (exit status: 101)

Metadata

Metadata

Assignees

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