Skip to content

[ICE]: delegation: unelided lifetime in signature #154178

@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: --crate-type=lib
#![feature(fn_delegation)]
fn foo<'b: 'b,  const N: usize>() {}
trait Trait {
	reuse foo::<1>;
}

Version information

rustc 1.96.0-nightly (e52f547ed 2026-03-21)
binary: rustc
commit-hash: e52f547ed4bc554e40ab63b264e8697b8e3c5e09
commit-date: 2026-03-21
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --crate-type=lib

Program output

warning: the feature `fn_delegation` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.r8Qz4JOBD3ks/rustc_testrunner_tmpdir_reporting.YYsj788lZ68v/mvce.rs:1:12
  |
1 | #![feature(fn_delegation)]
  |            ^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: function `foo` is never used
 --> /tmp/icemaker_global_tempdir.r8Qz4JOBD3ks/rustc_testrunner_tmpdir_reporting.YYsj788lZ68v/mvce.rs:2:4
  |
2 | fn foo<'b: 'b,  const N: usize>() {}
  |    ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: trait `Trait` is never used
 --> /tmp/icemaker_global_tempdir.r8Qz4JOBD3ks/rustc_testrunner_tmpdir_reporting.YYsj788lZ68v/mvce.rs:3:7
  |
3 | trait Trait {
  |       ^^^^^

warning: 3 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: unelided lifetime in signature
 --> /tmp/icemaker_global_tempdir.r8Qz4JOBD3ks/rustc_testrunner_tmpdir_reporting.YYsj788lZ68v/mvce.rs:4:8
  |
4 |     reuse foo::<1>;
  |           ^^^
  |
note: delayed at /rustc-dev/e52f547ed4bc554e40ab63b264e8697b8e3c5e09/compiler/rustc_hir_analysis/src/collect.rs:338:13
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
         4: <rustc_hir_analysis::collect::ItemCtxt as rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::re_infer
         5: <<dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt as rustc_hir_analysis::hir_ty_lowering::GenericArgsLowerer>::inferred_kind
         6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}
         7: rustc_hir_analysis::delegation::get_delegation_user_specified_args
         8: rustc_hir_analysis::delegation::inherit_sig_for_delegation_item
         9: rustc_query_impl::query_impl::inherit_sig_for_delegation_item::invoke_provider_fn::__rust_begin_short_backtrace
        10: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 16]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        11: rustc_query_impl::query_impl::inherit_sig_for_delegation_item::execute_query_non_incr::__rust_end_short_backtrace
        12: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
        13: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
        14: rustc_hir_analysis::collect::lower_fn_sig_recovering_infer_ret_ty
        15: rustc_hir_analysis::collect::fn_sig
        16: rustc_query_impl::query_impl::fn_sig::invoke_provider_fn::__rust_begin_short_backtrace
        17: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
        18: rustc_query_impl::query_impl::fn_sig::execute_query_non_incr::__rust_end_short_backtrace
        19: rustc_hir_analysis::check::check::check_item_type
        20: rustc_hir_analysis::check::wfcheck::check_well_formed
        21: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        22: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        23: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        24: rustc_hir_analysis::check::wfcheck::check_type_wf
        25: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        26: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        27: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        28: rustc_hir_analysis::check_crate
        29: rustc_interface::passes::analysis
        30: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        31: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        32: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        33: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        34: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        35: <std::sys::thread::unix::Thread>::new::thread_start
        36: <unknown>
        37: <unknown>
      
 --> /tmp/icemaker_global_tempdir.r8Qz4JOBD3ks/rustc_testrunner_tmpdir_reporting.YYsj788lZ68v/mvce.rs:4:8
  |
4 |     reuse foo::<1>;
  |           ^^^

error: internal compiler error: unelided lifetime in signature
 --> /tmp/icemaker_global_tempdir.r8Qz4JOBD3ks/rustc_testrunner_tmpdir_reporting.YYsj788lZ68v/mvce.rs:4:8
  |
4 |     reuse foo::<1>;
  |           ^^^
  |
note: delayed at /rustc-dev/e52f547ed4bc554e40ab63b264e8697b8e3c5e09/compiler/rustc_hir_analysis/src/collect.rs:338:13
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
         4: <rustc_hir_analysis::collect::ItemCtxt as rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::re_infer
         5: <<dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt as rustc_hir_analysis::hir_ty_lowering::GenericArgsLowerer>::inferred_kind
         6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}
         7: rustc_hir_analysis::delegation::get_delegation_user_specified_args
         8: rustc_hir_analysis::collect::predicates_of::gather_explicit_predicates_of::{closure#0}
         9: rustc_query_impl::query_impl::explicit_predicates_of::invoke_provider_fn::__rust_begin_short_backtrace
        10: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
        11: rustc_query_impl::query_impl::explicit_predicates_of::execute_query_non_incr::__rust_end_short_backtrace
        12: rustc_query_impl::query_impl::predicates_of::invoke_provider_fn::__rust_begin_short_backtrace
        13: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
        14: rustc_query_impl::query_impl::predicates_of::execute_query_non_incr::__rust_end_short_backtrace
        15: rustc_hir_analysis::check::check::check_item_type
        16: rustc_hir_analysis::check::wfcheck::check_well_formed
        17: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        18: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        19: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        20: rustc_hir_analysis::check::wfcheck::check_type_wf
        21: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        22: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        23: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        24: rustc_hir_analysis::check_crate
        25: rustc_interface::passes::analysis
        26: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        27: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        28: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        29: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        30: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        31: <std::sys::thread::unix::Thread>::new::thread_start
        32: <unknown>
        33: <unknown>
      
 --> /tmp/icemaker_global_tempdir.r8Qz4JOBD3ks/rustc_testrunner_tmpdir_reporting.YYsj788lZ68v/mvce.rs:4:8
  |
4 |     reuse foo::<1>;
  |           ^^^

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 (e52f547ed 2026-03-21) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-fn_delegation

Metadata

Metadata

Assignees

No one assigned

    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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions