Skip to content

[ICE]: assertion failed: self_ty.is_some() #153420

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

trait Trait{
    fn bar4();
}
impl Trait for () {
    reuse Trait::<> as bar4;
}

original:

#![feature(fn_delegation)]
trait Trait{
    fn bar4();
}
impl Trait for () {
    reuse Trait::<> as bar4;
}

fn main() {}

Version information

rustc 1.96.0-nightly (b90dc1e59 2026-03-04)
binary: rustc
commit-hash: b90dc1e597db0bbc0cab0eccb39747b1a9d7e607
commit-date: 2026-03-04
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Possibly related line of code:

if generics.parent.is_some() {
// The parent is a trait so it should have at least one
// generic parameter for the `Self` type.
assert!(!parent_args.is_empty())
} else {
// This item (presumably a trait) needs a self-type.
assert!(self_ty.is_some());
}
} else {
assert!(self_ty.is_none());
}
let arg_count =

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

Program output

error[E0423]: expected function, found trait `Trait`
 --> /tmp/icemaker_global_tempdir.kxGqBK3eThhO/rustc_testrunner_tmpdir_reporting.Mv9iDPBjanfo/mvce.rs:6:11
  |
6 |     reuse Trait::<> as bar4;
  |           ^^^^^^^^^ not a function

error[E0658]: functions delegation is not yet fully implemented
 --> /tmp/icemaker_global_tempdir.kxGqBK3eThhO/rustc_testrunner_tmpdir_reporting.Mv9iDPBjanfo/mvce.rs:6:5
  |
6 |     reuse Trait::<> as bar4;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
  = note: this compiler was built on 2026-03-04; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.kxGqBK3eThhO/rustc_testrunner_tmpdir_reporting.Mv9iDPBjanfo/mvce.rs:7:2
  |
7 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.kxGqBK3eThhO/rustc_testrunner_tmpdir_reporting.Mv9iDPBjanfo/mvce.rs`


thread 'rustc' (2422681) panicked at /rustc-dev/b90dc1e597db0bbc0cab0eccb39747b1a9d7e607/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:632:17:
assertion failed: self_ty.is_some()
stack backtrace:
   0:     0x7f5b9175b73b - <<std[82796cbe7e14e686]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[723ec164f49f73a3]::fmt::Display>::fmt
   1:     0x7f5b91e22948 - core[723ec164f49f73a3]::fmt::write
   2:     0x7f5b91772746 - <std[82796cbe7e14e686]::sys::stdio::unix::Stderr as std[82796cbe7e14e686]::io::Write>::write_fmt
   3:     0x7f5b91731818 - std[82796cbe7e14e686]::panicking::default_hook::{closure#0}
   4:     0x7f5b9174eba3 - std[82796cbe7e14e686]::panicking::default_hook
   5:     0x7f5b9073866c - std[82796cbe7e14e686]::panicking::update_hook::<alloc[774c2fc5b8157a70]::boxed::Box<rustc_driver_impl[cc40153740e5fbc5]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f5b9174ee82 - std[82796cbe7e14e686]::panicking::panic_with_hook
   7:     0x7f5b9173190a - std[82796cbe7e14e686]::panicking::panic_handler::{closure#0}
   8:     0x7f5b91728609 - std[82796cbe7e14e686]::sys::backtrace::__rust_end_short_backtrace::<std[82796cbe7e14e686]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f5b9173333d - __rustc[eda097aff079559a]::rust_begin_unwind
  10:     0x7f5b8e31c61c - core[723ec164f49f73a3]::panicking::panic_fmt
  11:     0x7f5b8de00022 - core[723ec164f49f73a3]::panicking::panic
  12:     0x7f5b92513965 - <dyn rustc_hir_analysis[e0c4acfd5fb67af7]::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}
  13:     0x7f5b908d004f - rustc_hir_analysis[e0c4acfd5fb67af7]::delegation::get_delegation_user_specified_args
  14:     0x7f5b908cf32f - rustc_hir_analysis[e0c4acfd5fb67af7]::delegation::inherit_sig_for_delegation_item
  15:     0x7f5b911eadf2 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::inherit_sig_for_delegation_item::invoke_provider_fn::__rust_begin_short_backtrace
  16:     0x7f5b927a480c - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_data_structures[b07b151140ce4279]::vec_cache::VecCache<rustc_span[da1975f195527d0f]::def_id::LocalDefId, rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 16usize]>, rustc_middle[9b0503ad92008f82]::dep_graph::graph::DepNodeIndex>, false>
  17:     0x7f5b911eae5a - rustc_query_impl[eb5d4e66a16195f6]::query_impl::inherit_sig_for_delegation_item::execute_query_non_incr::__rust_end_short_backtrace
  18:     0x7f5b9250d293 - <dyn rustc_hir_analysis[e0c4acfd5fb67af7]::hir_ty_lowering::HirTyLowerer>::lower_ty
  19:     0x7f5b9252262f - <dyn rustc_hir_analysis[e0c4acfd5fb67af7]::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  20:     0x7f5b92104cfc - rustc_hir_analysis[e0c4acfd5fb67af7]::collect::fn_sig
  21:     0x7f5b92104466 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::fn_sig::invoke_provider_fn::__rust_begin_short_backtrace
  22:     0x7f5b92108ba0 - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_middle[9b0503ad92008f82]::query::caches::DefIdCache<rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 24usize]>>, false>
  23:     0x7f5b92108093 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::fn_sig::execute_query_non_incr::__rust_end_short_backtrace
  24:     0x7f5b927ab5eb - rustc_hir_analysis[e0c4acfd5fb67af7]::check::compare_impl_item::check_method_is_structurally_compatible
  25:     0x7f5b927b0a47 - rustc_hir_analysis[e0c4acfd5fb67af7]::check::compare_impl_item::compare_impl_item
  26:     0x7f5b927b05e9 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::compare_impl_item::invoke_provider_fn::__rust_begin_short_backtrace
  27:     0x7f5b92b51799 - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_data_structures[b07b151140ce4279]::vec_cache::VecCache<rustc_span[da1975f195527d0f]::def_id::LocalDefId, rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[9b0503ad92008f82]::dep_graph::graph::DepNodeIndex>, false>
  28:     0x7f5b92b5128e - rustc_query_impl[eb5d4e66a16195f6]::query_impl::compare_impl_item::execute_query_non_incr::__rust_end_short_backtrace
  29:     0x7f5b92b54740 - rustc_hir_analysis[e0c4acfd5fb67af7]::check::check::check_item_type
  30:     0x7f5b92b52226 - rustc_hir_analysis[e0c4acfd5fb67af7]::check::wfcheck::check_well_formed
  31:     0x7f5b92b52207 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  32:     0x7f5b92b51799 - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_data_structures[b07b151140ce4279]::vec_cache::VecCache<rustc_span[da1975f195527d0f]::def_id::LocalDefId, rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[9b0503ad92008f82]::dep_graph::graph::DepNodeIndex>, false>
  33:     0x7f5b92b514fb - rustc_query_impl[eb5d4e66a16195f6]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  34:     0x7f5b92b4e3fd - rustc_hir_analysis[e0c4acfd5fb67af7]::check::wfcheck::check_type_wf
  35:     0x7f5b92b4e307 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  36:     0x7f5b93086797 - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_middle[9b0503ad92008f82]::query::caches::SingleCache<rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 1usize]>>, false>
  37:     0x7f5b93086569 - rustc_query_impl[eb5d4e66a16195f6]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  38:     0x7f5b9289d915 - rustc_hir_analysis[e0c4acfd5fb67af7]::check_crate
  39:     0x7f5b91f42e93 - rustc_interface[5358b22c06b9f13b]::passes::analysis
  40:     0x7f5b9308835c - rustc_query_impl[eb5d4e66a16195f6]::execution::try_execute_query::<rustc_middle[9b0503ad92008f82]::query::caches::SingleCache<rustc_middle[9b0503ad92008f82]::query::erase::ErasedData<[u8; 0usize]>>, false>
  41:     0x7f5b930880bb - rustc_query_impl[eb5d4e66a16195f6]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  42:     0x7f5b9305bdad - rustc_interface[5358b22c06b9f13b]::interface::run_compiler::<(), rustc_driver_impl[cc40153740e5fbc5]::run_compiler::{closure#0}>::{closure#1}
  43:     0x7f5b930322be - std[82796cbe7e14e686]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_with_globals<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_pool_with_globals<rustc_interface[5358b22c06b9f13b]::interface::run_compiler<(), rustc_driver_impl[cc40153740e5fbc5]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  44:     0x7f5b93032920 - <std[82796cbe7e14e686]::thread::lifecycle::spawn_unchecked<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_with_globals<rustc_interface[5358b22c06b9f13b]::util::run_in_thread_pool_with_globals<rustc_interface[5358b22c06b9f13b]::interface::run_compiler<(), rustc_driver_impl[cc40153740e5fbc5]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[723ec164f49f73a3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7f5b930337ac - <std[82796cbe7e14e686]::sys::thread::unix::Thread>::new::thread_start
  46:     0x7f5b8caa598b - <unknown>
  47:     0x7f5b8cb29a0c - <unknown>
  48:                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.96.0-nightly (b90dc1e59 2026-03-04) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [inherit_sig_for_delegation_item] inheriting delegation signature
#1 [fn_sig] computing function signature of `<impl at /tmp/icemaker_global_tempdir.kxGqBK3eThhO/rustc_testrunner_tmpdir_reporting.Mv9iDPBjanfo/mvce.rs:5:1: 5:18>::bar4`
#2 [compare_impl_item] checking assoc item `<impl at /tmp/icemaker_global_tempdir.kxGqBK3eThhO/rustc_testrunner_tmpdir_reporting.Mv9iDPBjanfo/mvce.rs:5:1: 5:18>::bar4` is compatible with trait definition
#3 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.kxGqBK3eThhO/rustc_testrunner_tmpdir_reporting.Mv9iDPBjanfo/mvce.rs:5:1: 5:18>` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors

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

@rustbot label +F-fn_delegation

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-fn_delegation`#![feature(fn_delegation)]`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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions