Skip to content

ICE: compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs None #138229

Closed
@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: --edition=2024
pub struct Flatten<I>
where
    Iterator<Item: >:, {}

Version information

rustc 1.87.0-nightly (cdd8af229 2025-03-08)
binary: rustc
commit-hash: cdd8af229960d05c8dfe5ca3e5f5e2066e676213
commit-date: 2025-03-08
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Possibly related line of code:

if let hir::ItemKind::Enum(..) = parent_item.kind {
return false;
}
// If the parent item is a struct, check if self_ty is the last field.
if let hir::ItemKind::Struct(variant_data, _) = parent_item.kind {
if variant_data.fields().last().unwrap().ty.span != self_ty.span {
return false;
}
}
// FIXME: Only emit this suggestion if the trait is dyn-compatible.
diag.multipart_suggestion_verbose(

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2024

Program output

error: associated type bounds are not allowed in `dyn` types
 --> /tmp/icemaker_global_tempdir.1fddo3thr4FG/rustc_testrunner_tmpdir_reporting.q7t4VPLdZITs/mvce.rs:3:14
  |
3 |     Iterator<Item: >:, {}
  |              ^^^^^

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.1fddo3thr4FG/rustc_testrunner_tmpdir_reporting.q7t4VPLdZITs/mvce.rs:3:26
  |
3 |     Iterator<Item: >:, {}
  |                          ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.1fddo3thr4FG/rustc_testrunner_tmpdir_reporting.q7t4VPLdZITs/mvce.rs`


thread 'rustc' panicked at compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs:219:45:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x74270adc79d4 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd713c4d8f2a992f7
   1:     0x74270b605a62 - core::fmt::write::hd251c22aa3b08f95
   2:     0x74270c9af011 - std::io::Write::write_fmt::h9618bab13245ea22
   3:     0x74270adc7832 - std::sys::backtrace::BacktraceLock::print::ha3210e3903b3f60d
   4:     0x74270adca112 - std::panicking::default_hook::{{closure}}::h6ffc694d8b54cfbc
   5:     0x74270adc9d04 - std::panicking::default_hook::h18f17c54de83d745
   6:     0x742709f20d37 - std[ea1c415d91c3a3f3]::panicking::update_hook::<alloc[2e89a6e6a742d90a]::boxed::Box<rustc_driver_impl[6d217ad2d5c0cd23]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x74270adca983 - std::panicking::rust_panic_with_hook::h671b37e3b2b9a0c6
   8:     0x74270adca646 - std::panicking::begin_panic_handler::{{closure}}::h274c9dfd04385a24
   9:     0x74270adc7e99 - std::sys::backtrace::__rust_end_short_backtrace::h23c8ca15e79f68ed
  10:     0x74270adca33d - rust_begin_unwind
  11:     0x742707a5ec80 - core::panicking::panic_fmt::hd63d1c0540a60bdc
  12:     0x74270854bd6c - core::panicking::panic::h56e792821a9251e2
  13:     0x742708aeb839 - core::option::unwrap_failed::hb932d1e707961bac
  14:     0x74270c86832a - <dyn rustc_hir_analysis[b5445f66d222153f]::hir_ty_lowering::HirTyLowerer>::prohibit_or_lint_bare_trait_object_ty
  15:     0x74270bd62ff6 - <dyn rustc_hir_analysis[b5445f66d222153f]::hir_ty_lowering::HirTyLowerer>::lower_ty
  16:     0x74270bb0ef87 - rustc_hir_analysis[b5445f66d222153f]::collect::predicates_of::gather_explicit_predicates_of
  17:     0x74270bb0d25f - rustc_query_impl[bdafc42a67792f6b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bdafc42a67792f6b]::query_impl::explicit_predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 24usize]>>
  18:     0x74270bafe7eb - rustc_query_system[e28bb8395bb88072]::query::plumbing::try_execute_query::<rustc_query_impl[bdafc42a67792f6b]::DynamicConfig<rustc_query_system[e28bb8395bb88072]::query::caches::DefIdCache<rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[bdafc42a67792f6b]::plumbing::QueryCtxt, false>
  19:     0x74270bafe124 - rustc_query_impl[bdafc42a67792f6b]::query_impl::explicit_predicates_of::get_query_non_incr::__rust_end_short_backtrace
  20:     0x74270bafc7bf - rustc_hir_analysis[b5445f66d222153f]::collect::predicates_of::predicates_of
  21:     0x74270bafc6e1 - rustc_query_impl[bdafc42a67792f6b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bdafc42a67792f6b]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 24usize]>>
  22:     0x74270bafe7cf - rustc_query_system[e28bb8395bb88072]::query::plumbing::try_execute_query::<rustc_query_impl[bdafc42a67792f6b]::DynamicConfig<rustc_query_system[e28bb8395bb88072]::query::caches::DefIdCache<rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[bdafc42a67792f6b]::plumbing::QueryCtxt, false>
  23:     0x74270bafe024 - rustc_query_impl[bdafc42a67792f6b]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
  24:     0x74270bd9051a - <rustc_hir_analysis[b5445f66d222153f]::collect::CollectItemTypesVisitor as rustc_hir[7b5749dda82e61]::intravisit::Visitor>::visit_item
  25:     0x74270bd84005 - rustc_hir_analysis[b5445f66d222153f]::check::wfcheck::check_well_formed
  26:     0x74270bd83e11 - rustc_query_impl[bdafc42a67792f6b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bdafc42a67792f6b]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 1usize]>>
  27:     0x74270bd838c8 - rustc_query_system[e28bb8395bb88072]::query::plumbing::try_execute_query::<rustc_query_impl[bdafc42a67792f6b]::DynamicConfig<rustc_data_structures[8222949f9d1c4f5]::vec_cache::VecCache<rustc_span[c79046a8f90eac9]::def_id::LocalDefId, rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[e28bb8395bb88072]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[bdafc42a67792f6b]::plumbing::QueryCtxt, false>
  28:     0x74270bd83383 - rustc_query_impl[bdafc42a67792f6b]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  29:     0x74270bd80b9d - rustc_hir_analysis[b5445f66d222153f]::check::wfcheck::check_mod_type_wf
  30:     0x74270bd8099f - rustc_query_impl[bdafc42a67792f6b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bdafc42a67792f6b]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 1usize]>>
  31:     0x74270c6a64d6 - rustc_query_system[e28bb8395bb88072]::query::plumbing::try_execute_query::<rustc_query_impl[bdafc42a67792f6b]::DynamicConfig<rustc_query_system[e28bb8395bb88072]::query::caches::DefaultCache<rustc_span[c79046a8f90eac9]::def_id::LocalModDefId, rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bdafc42a67792f6b]::plumbing::QueryCtxt, false>
  32:     0x74270c6a627f - rustc_query_impl[bdafc42a67792f6b]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  33:     0x74270b95c34f - rustc_hir_analysis[b5445f66d222153f]::check_crate
  34:     0x74270ba2e8b4 - rustc_interface[82f631b64fcfc832]::passes::run_required_analyses
  35:     0x74270c5caafa - rustc_interface[82f631b64fcfc832]::passes::analysis
  36:     0x74270c5caad9 - rustc_query_impl[bdafc42a67792f6b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bdafc42a67792f6b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 0usize]>>
  37:     0x74270c6c6d0b - rustc_query_system[e28bb8395bb88072]::query::plumbing::try_execute_query::<rustc_query_impl[bdafc42a67792f6b]::DynamicConfig<rustc_query_system[e28bb8395bb88072]::query::caches::SingleCache<rustc_middle[40f7eeb9b5af1651]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[bdafc42a67792f6b]::plumbing::QueryCtxt, false>
  38:     0x74270c6c69f9 - rustc_query_impl[bdafc42a67792f6b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  39:     0x74270c75bdfd - rustc_interface[82f631b64fcfc832]::passes::create_and_enter_global_ctxt::<core[146ed0f78261ee61]::option::Option<rustc_interface[82f631b64fcfc832]::queries::Linker>, rustc_driver_impl[6d217ad2d5c0cd23]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  40:     0x74270c73d1e0 - rustc_interface[82f631b64fcfc832]::interface::run_compiler::<(), rustc_driver_impl[6d217ad2d5c0cd23]::run_compiler::{closure#0}>::{closure#1}
  41:     0x74270c5b4d88 - std[ea1c415d91c3a3f3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[82f631b64fcfc832]::util::run_in_thread_with_globals<rustc_interface[82f631b64fcfc832]::util::run_in_thread_pool_with_globals<rustc_interface[82f631b64fcfc832]::interface::run_compiler<(), rustc_driver_impl[6d217ad2d5c0cd23]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  42:     0x74270c5b5674 - <<std[ea1c415d91c3a3f3]::thread::Builder>::spawn_unchecked_<rustc_interface[82f631b64fcfc832]::util::run_in_thread_with_globals<rustc_interface[82f631b64fcfc832]::util::run_in_thread_pool_with_globals<rustc_interface[82f631b64fcfc832]::interface::run_compiler<(), rustc_driver_impl[6d217ad2d5c0cd23]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[146ed0f78261ee61]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x74270c5b6a6b - std::sys::pal::unix::thread::Thread::new::thread_start::hf813d01f8068137e
  44:     0x74270665e70a - <unknown>
  45:     0x7427066e2aac - <unknown>
  46:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.87.0-nightly (cdd8af229 2025-03-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z dump-mir-dir=dir

query stack during panic:
#0 [explicit_predicates_of] computing explicit predicates of `Flatten`
#1 [predicates_of] computing predicates of `Flatten`
#2 [check_well_formed] checking that `Flatten` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

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

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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