Skip to content

[ICE]: unelided lifetime in signature #156848

@matthiaskrgr

Description

@matthiaskrgr

snippet:

#![feature(fn_delegation)]
mod test_5 {
    trait Trait {
        fn foo<'a: 'a>(&self) {}
    }
    struct F;
    impl Trait for F {}
    struct S(F);
    impl S {
        reuse Trait::foo::<> { self.0 }
    }
}
fn main() {}

Version information

rustc 1.98.0-nightly (54333ff07 2026-05-22)
binary: rustc
commit-hash: 54333ff079780f803f65dcee30c544050b35f544
commit-date: 2026-05-22
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

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

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.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/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: trait `Trait` is never used
 --> /tmp/icemaker_global_tempdir.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:3:11
  |
3 |     trait Trait {
  |           ^^^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: struct `F` is never constructed
 --> /tmp/icemaker_global_tempdir.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:6:12
  |
6 |     struct F;
  |            ^

warning: struct `S` is never constructed
 --> /tmp/icemaker_global_tempdir.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:8:12
  |
8 |     struct S(F);
  |            ^

warning: method `foo` is never used
  --> /tmp/icemaker_global_tempdir.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:10:22
   |
 9 |     impl S {
   |     ------ method in this implementation
10 |         reuse Trait::foo::<> { self.0 }
   |                      ^^^

warning: 5 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.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:10:22
   |
10 |         reuse Trait::foo::<> { self.0 }
   |                      ^^^
   |
note: delayed at /rustc-dev/54333ff079780f803f65dcee30c544050b35f544/compiler/rustc_hir_analysis/src/collect.rs:339: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}
         6: rustc_hir_analysis::delegation::get_delegation_user_specified_args
         7: rustc_hir_analysis::delegation::inherit_sig_for_delegation_item
         8: rustc_query_impl::query_impl::inherit_sig_for_delegation_item::invoke_provider_fn::__rust_begin_short_backtrace
         9: 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>
        10: rustc_query_impl::query_impl::inherit_sig_for_delegation_item::execute_query_non_incr::__rust_end_short_backtrace
        11: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
        12: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
        13: rustc_hir_analysis::collect::lower_fn_sig_recovering_infer_ret_ty
        14: rustc_hir_analysis::collect::fn_sig
        15: rustc_query_impl::query_impl::fn_sig::invoke_provider_fn::__rust_begin_short_backtrace
        16: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
        17: rustc_query_impl::query_impl::fn_sig::execute_query_non_incr::__rust_end_short_backtrace
        18: rustc_hir_analysis::check::check::check_item_type
        19: rustc_hir_analysis::check::wfcheck::check_well_formed
        20: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        21: 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>
        22: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        23: rustc_hir_analysis::check::wfcheck::check_type_wf
        24: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        25: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        26: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        27: rustc_hir_analysis::check_crate
        28: rustc_interface::passes::analysis
        29: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        30: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        31: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        32: 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}, ()>
        33: <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}
        34: <std::sys::thread::unix::Thread>::new::thread_start
        35: <unknown>
        36: <unknown>
      
  --> /tmp/icemaker_global_tempdir.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:10:22
   |
10 |         reuse Trait::foo::<> { self.0 }
   |                      ^^^

error: internal compiler error: unelided lifetime in signature
  --> /tmp/icemaker_global_tempdir.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:10:22
   |
10 |         reuse Trait::foo::<> { self.0 }
   |                      ^^^
   |
note: delayed at /rustc-dev/54333ff079780f803f65dcee30c544050b35f544/compiler/rustc_hir_analysis/src/collect.rs:339: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}
         6: rustc_hir_analysis::delegation::get_delegation_user_specified_args
         7: rustc_hir_analysis::collect::predicates_of::gather_explicit_predicates_of::{closure#0}
         8: rustc_query_impl::query_impl::explicit_predicates_of::invoke_provider_fn::__rust_begin_short_backtrace
         9: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
        10: rustc_query_impl::query_impl::explicit_predicates_of::execute_query_non_incr::__rust_end_short_backtrace
        11: rustc_query_impl::query_impl::predicates_of::invoke_provider_fn::__rust_begin_short_backtrace
        12: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
        13: rustc_query_impl::query_impl::predicates_of::execute_query_non_incr::__rust_end_short_backtrace
        14: rustc_hir_analysis::check::check::check_item_type
        15: rustc_hir_analysis::check::wfcheck::check_well_formed
        16: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        17: 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>
        18: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        19: rustc_hir_analysis::check::wfcheck::check_type_wf
        20: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        21: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        22: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        23: rustc_hir_analysis::check_crate
        24: rustc_interface::passes::analysis
        25: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        26: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        27: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        28: 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}, ()>
        29: <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}
        30: <std::sys::thread::unix::Thread>::new::thread_start
        31: <unknown>
        32: <unknown>
      
  --> /tmp/icemaker_global_tempdir.i6Ma6YZdHSzJ/rustc_testrunner_tmpdir_reporting.VBThQ6b57ie8/mvce.rs:10:22
   |
10 |         reuse Trait::foo::<> { self.0 }
   |                      ^^^

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.98.0-nightly (54333ff07 2026-05-22) running on x86_64-unknown-linux-gnu

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.

    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