Skip to content

ICE simplify_type is None #148062

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

use std::ops::DispatchFromDyn;

impl<T> DispatchFromDyn<Self<U, MISC>> for T {}

original:

use std::ops::DispatchFromDyn; //~ ERROR use of unstable library feature 'dispatch_from_dyn'
struct Smaht<T, MISC>(PhantomData); //~ ERROR cannot find type `PhantomData` in this scope
impl<T> DispatchFromDyn<Self<U, MISC>> for T {} //~ ERROR cannot find type `U` in this scope
//~^ ERROR cannot find type `MISC` in this scope
//~| ERROR use of unstable library feature 'dispatch_from_dyn'
//~| ERROR the trait `DispatchFromDyn` may only be implemented for a coercion between structures
trait Foo: X<u32> {}
trait X<T> {
    fn foo(self: Smaht<Self, T>);
}
trait Marker {}
impl Marker for dyn Foo {}
fn main() {}

Version information

rustc 1.92.0-nightly (6501e64fc 2025-10-23)
binary: rustc
commit-hash: 6501e64fcb02d22b49d6e59d10a7692ec8095619
commit-date: 2025-10-23
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0412]: cannot find type `U` in this scope
 --> /tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs:3:30
  |
3 | impl<T> DispatchFromDyn<Self<U, MISC>> for T {}
  |      -                       ^
  |      |
  |      similarly named type parameter `T` defined here
  |
help: a type parameter with a similar name exists
  |
3 - impl<T> DispatchFromDyn<Self<U, MISC>> for T {}
3 + impl<T> DispatchFromDyn<Self<T, MISC>> for T {}
  |
help: you might be missing a type parameter
  |
3 | impl<T, U> DispatchFromDyn<Self<U, MISC>> for T {}
  |       +++

error[E0412]: cannot find type `MISC` in this scope
 --> /tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs:3:33
  |
3 | impl<T> DispatchFromDyn<Self<U, MISC>> for T {}
  |                                 ^^^^ not found in this scope
  |
help: you might be missing a type parameter
  |
3 | impl<T, MISC> DispatchFromDyn<Self<U, MISC>> for T {}
  |       ++++++

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs:3:48
  |
3 | impl<T> DispatchFromDyn<Self<U, MISC>> for T {}
  |                                                ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs`

error[E0658]: use of unstable library feature `dispatch_from_dyn`
 --> /tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs:1:5
  |
1 | use std::ops::DispatchFromDyn;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable
  = note: this compiler was built on 2025-10-23; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `dispatch_from_dyn`
 --> /tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs:3:9
  |
3 | impl<T> DispatchFromDyn<Self<U, MISC>> for T {}
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable
  = note: this compiler was built on 2025-10-23; consider upgrading it if it is out of date

error[E0109]: type arguments are not allowed on self type
 --> /tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs:3:30
  |
3 | impl<T> DispatchFromDyn<Self<U, MISC>> for T {}
  |                         ---- ^  ^^^^ type argument not allowed
  |                         |
  |                         not allowed on self type


thread 'rustc' (1461990) panicked at /rustc-dev/6501e64fcb02d22b49d6e59d10a7692ec8095619/compiler/rustc_middle/src/ty/context.rs:594:18:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7f75d3a51333 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9cc4873ee28b174b
   1:     0x7f75d4201ad8 - core::fmt::write::h98addc6f16b029c7
   2:     0x7f75d3a056c3 - std::io::Write::write_fmt::h0c1167b64e42f3ed
   3:     0x7f75d3a16eb2 - std::sys::backtrace::BacktraceLock::print::ha14c16ec61850d40
   4:     0x7f75d3a1cf89 - std::panicking::default_hook::{{closure}}::h2b656990bb84d955
   5:     0x7f75d3a1cab3 - std::panicking::default_hook::h279ceada925c78c1
   6:     0x7f75d2a1e411 - std[fd8bdcf0604f9ff9]::panicking::update_hook::<alloc[1b07cabb90717b2a]::boxed::Box<rustc_driver_impl[7ca1d88a9e5124d8]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7f75d3a1d3af - std::panicking::panic_with_hook::hae2a27acfb2df435
   8:     0x7f75d3a1d136 - std::panicking::panic_handler::{{closure}}::hc339ae507b9da894
   9:     0x7f75d3a16ff9 - std::sys::backtrace::__rust_end_short_backtrace::ha26661647ee40c8b
  10:     0x7f75d39f79ed - __rustc[4683036c762297f9]::rust_begin_unwind
  11:     0x7f75d099ef00 - core::panicking::panic_fmt::h7a39be529a1dbf2a
  12:     0x7f75d05080ac - core::panicking::panic::h101864b30fec8753
  13:     0x7f75d0fdfdd9 - core::option::unwrap_failed::hfd3ff7990d5ac0fd
  14:     0x7f75d5035d9b - <rustc_next_trait_solver[7ac68f521ec36205]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[a6494bee1d9299fd]::solve::delegate::SolverDelegate, rustc_middle[dd38cab520e6dc5e]::ty::context::TyCtxt>>::compute_trait_goal
  15:     0x7f75d502c23e - <rustc_next_trait_solver[7ac68f521ec36205]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[a6494bee1d9299fd]::solve::delegate::SolverDelegate> as rustc_type_ir[a7a824f1d4d78885]::search_graph::Delegate>::compute_goal::{closure#0}
  16:     0x7f75d4eb9f59 - <rustc_next_trait_solver[7ac68f521ec36205]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[a6494bee1d9299fd]::solve::delegate::SolverDelegate, rustc_middle[dd38cab520e6dc5e]::ty::context::TyCtxt>>::evaluate_goal_raw
  17:     0x7f75d4eb6a34 - rustc_trait_selection[a6494bee1d9299fd]::traits::coherence::overlap
  18:     0x7f75d0577362 - <rustc_middle[dd38cab520e6dc5e]::traits::specialization_graph::Children as rustc_trait_selection[a6494bee1d9299fd]::traits::specialize::specialization_graph::ChildrenExt>::insert
  19:     0x7f75d432c3fe - <rustc_middle[dd38cab520e6dc5e]::traits::specialization_graph::Graph as rustc_trait_selection[a6494bee1d9299fd]::traits::specialize::specialization_graph::GraphExt>::insert
  20:     0x7f75d432d8eb - rustc_trait_selection[a6494bee1d9299fd]::traits::specialize::specialization_graph_provider
  21:     0x7f75d432d30d - rustc_query_impl[33a52a5f67597d1e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33a52a5f67597d1e]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 8usize]>>
  22:     0x7f75d421af92 - rustc_query_system[66f071feb03fff53]::query::plumbing::try_execute_query::<rustc_query_impl[33a52a5f67597d1e]::DynamicConfig<rustc_query_system[66f071feb03fff53]::query::caches::DefIdCache<rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[33a52a5f67597d1e]::plumbing::QueryCtxt, false>
  23:     0x7f75d4a83037 - rustc_query_impl[33a52a5f67597d1e]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f75d4a83390 - rustc_hir_analysis[6282814ce3f84a1e]::coherence::coherent_trait
  25:     0x7f75d4a8305f - rustc_query_impl[33a52a5f67597d1e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33a52a5f67597d1e]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7f75d4a14f23 - rustc_query_system[66f071feb03fff53]::query::plumbing::try_execute_query::<rustc_query_impl[33a52a5f67597d1e]::DynamicConfig<rustc_query_system[66f071feb03fff53]::query::caches::DefIdCache<rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[33a52a5f67597d1e]::plumbing::QueryCtxt, false>
  27:     0x7f75d4a13fa4 - rustc_query_impl[33a52a5f67597d1e]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f75d4a91d64 - rustc_hir_analysis[6282814ce3f84a1e]::check::check::check_item_type
  29:     0x7f75d4a8cefa - rustc_hir_analysis[6282814ce3f84a1e]::check::wfcheck::check_well_formed
  30:     0x7f75d4a8cedb - rustc_query_impl[33a52a5f67597d1e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33a52a5f67597d1e]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7f75d4a8c752 - rustc_query_system[66f071feb03fff53]::query::plumbing::try_execute_query::<rustc_query_impl[33a52a5f67597d1e]::DynamicConfig<rustc_data_structures[325e7ca358998869]::vec_cache::VecCache<rustc_span[3b6b3a02da984728]::def_id::LocalDefId, rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[66f071feb03fff53]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[33a52a5f67597d1e]::plumbing::QueryCtxt, false>
  32:     0x7f75d4a8c256 - rustc_query_impl[33a52a5f67597d1e]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f75d4a89930 - rustc_hir_analysis[6282814ce3f84a1e]::check::wfcheck::check_type_wf
  34:     0x7f75d4a89825 - rustc_query_impl[33a52a5f67597d1e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33a52a5f67597d1e]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 1usize]>>
  35:     0x7f75d5254320 - rustc_query_system[66f071feb03fff53]::query::plumbing::try_execute_query::<rustc_query_impl[33a52a5f67597d1e]::DynamicConfig<rustc_query_system[66f071feb03fff53]::query::caches::SingleCache<rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[33a52a5f67597d1e]::plumbing::QueryCtxt, false>
  36:     0x7f75d5254102 - rustc_query_impl[33a52a5f67597d1e]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f75d4a2303a - rustc_hir_analysis[6282814ce3f84a1e]::check_crate
  38:     0x7f75d4c739f0 - rustc_interface[3b9a80f2e3227d66]::passes::analysis
  39:     0x7f75d4c736b5 - rustc_query_impl[33a52a5f67597d1e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[33a52a5f67597d1e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 0usize]>>
  40:     0x7f75d525a8e0 - rustc_query_system[66f071feb03fff53]::query::plumbing::try_execute_query::<rustc_query_impl[33a52a5f67597d1e]::DynamicConfig<rustc_query_system[66f071feb03fff53]::query::caches::SingleCache<rustc_middle[dd38cab520e6dc5e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[33a52a5f67597d1e]::plumbing::QueryCtxt, false>
  41:     0x7f75d525a536 - rustc_query_impl[33a52a5f67597d1e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f75d5536d0a - <rustc_interface[3b9a80f2e3227d66]::passes::create_and_enter_global_ctxt<core[718be09216eb06d0]::option::Option<rustc_interface[3b9a80f2e3227d66]::queries::Linker>, rustc_driver_impl[7ca1d88a9e5124d8]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[718be09216eb06d0]::ops::function::FnOnce<(&rustc_session[e0a9e5b6367986f8]::session::Session, rustc_middle[dd38cab520e6dc5e]::ty::context::CurrentGcx, alloc[1b07cabb90717b2a]::sync::Arc<rustc_data_structures[325e7ca358998869]::jobserver::Proxy>, &std[fd8bdcf0604f9ff9]::sync::once_lock::OnceLock<rustc_middle[dd38cab520e6dc5e]::ty::context::GlobalCtxt>, &rustc_data_structures[325e7ca358998869]::sync::worker_local::WorkerLocal<rustc_middle[dd38cab520e6dc5e]::arena::Arena>, &rustc_data_structures[325e7ca358998869]::sync::worker_local::WorkerLocal<rustc_hir[9fa2a18b1818a3e3]::Arena>, rustc_driver_impl[7ca1d88a9e5124d8]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  43:     0x7f75d52de122 - rustc_interface[3b9a80f2e3227d66]::interface::run_compiler::<(), rustc_driver_impl[7ca1d88a9e5124d8]::run_compiler::{closure#0}>::{closure#1}
  44:     0x7f75d4f82abc - std[fd8bdcf0604f9ff9]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3b9a80f2e3227d66]::util::run_in_thread_with_globals<rustc_interface[3b9a80f2e3227d66]::util::run_in_thread_pool_with_globals<rustc_interface[3b9a80f2e3227d66]::interface::run_compiler<(), rustc_driver_impl[7ca1d88a9e5124d8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  45:     0x7f75d4f827a0 - <<std[fd8bdcf0604f9ff9]::thread::Builder>::spawn_unchecked_<rustc_interface[3b9a80f2e3227d66]::util::run_in_thread_with_globals<rustc_interface[3b9a80f2e3227d66]::util::run_in_thread_pool_with_globals<rustc_interface[3b9a80f2e3227d66]::interface::run_compiler<(), rustc_driver_impl[7ca1d88a9e5124d8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[718be09216eb06d0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x7f75d4f80a2f - std::sys::thread::unix::Thread::new::thread_start::h27baf5f3ef7ea848
  47:     0x7f75cea969cb - <unknown>
  48:     0x7f75ceb1aa0c - <unknown>
  49:                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.92.0-nightly (6501e64fc 2025-10-23) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `core::ops::unsize::DispatchFromDyn`
#1 [coherent_trait] coherence checking all impls of trait `core::ops::unsize::DispatchFromDyn`
#2 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.zb32Pr7egJaQ/rustc_testrunner_tmpdir_reporting.gwkqTnHQHpcg/mvce.rs:3:1: 3:45>` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0109, E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0109`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-dispatch_from_dyn`#![feature(dispatch_from_dyn)]`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