Skip to content

ICE unelided lifetime in signature #149809

@reddevilmidzy

Description

@reddevilmidzy

Code

#![allow(incomplete_features, unused)]
#![feature(min_generic_const_args)]
#![feature(inherent_associated_types)]
struct Foo<'a> {
    x: &'a (),
}

impl<'a> Foo<'a> {
    #[type_const]
    const X: usize = 1;
    fn foo(_: [u8; Foo::X]) {}
}

fn main() {}

rustc --version --verbose:

rustc 1.94.0-nightly (37aa2135b 2025-12-08)
binary: rustc
commit-hash: 37aa2135b5d0936bd13aa699d941aaa94fbaa645
commit-date: 2025-12-08
host: x86_64-pc-windows-msvc
release: 1.94.0-nightly
LLVM version: 21.1.5
Backtrace

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
  --> src/main.rs:11:20
   |
11 |     fn foo(_: [u8; Foo::X]) {}
   |                    ^^^
   |
note: delayed at compiler\rustc_hir_analysis\src\collect.rs:334:13
         0: std::backtrace_rs::backtrace::win64::trace
                   at /rustc/37aa2135b5d0936bd13aa699d941aaa94fbaa645/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
         1: std::backtrace_rs::backtrace::trace_unsynchronized
                   at /rustc/37aa2135b5d0936bd13aa699d941aaa94fbaa645/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
         2: std::backtrace::Backtrace::create
                   at /rustc/37aa2135b5d0936bd13aa699d941aaa94fbaa645/library\std\src\backtrace.rs:331
         3: std::backtrace::Backtrace::capture
                   at /rustc/37aa2135b5d0936bd13aa699d941aaa94fbaa645/library\std\src\backtrace.rs:296
         4: <rustc_errors::DiagCtxtHandle>::has_errors_excluding_lint_errors
         5: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         6: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         7: <hashbrown::raw::RawTable<usize>>::reserve_rehash::<indexmap::map::core::get_hash<(rustc_middle::ty::region::Region, usize), ()>::{closure#0}>
         8: <rustc_hir_analysis::collect::ItemCtxt as rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::re_infer
         9: RINvMs6_NtCsadIYlX8YUoA_9hashbrown3rawINtB6_8RawTablejE14reserve_rehashNCINvNtNtCse6OYZ94Gju2_8indexmap3map4core8get_hashTNtNtNtCsbXszlfw18sr_12rustc_middle2ty9predicate6ClauseNtNtCs7oA9ExUwCrc_10rustc_span13span_encoding4SpanEuE0ECs5HL0smY5QW1_18rustc_hir
        10: RINvMs6_NtCsadIYlX8YUoA_9hashbrown3rawINtB6_8RawTablejE14reserve_rehashNCINvNtNtCse6OYZ94Gju2_8indexmap3map4core8get_hashTNtNtNtCsbXszlfw18sr_12rustc_middle2ty9predicate6ClauseNtNtCs7oA9ExUwCrc_10rustc_span13span_encoding4SpanEuE0ECs5HL0smY5QW1_18rustc_hir
        11: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_const_arg
        12: RINvMs6_NtCsadIYlX8YUoA_9hashbrown3rawINtB6_8RawTablejE14reserve_rehashNCINvNtNtCse6OYZ94Gju2_8indexmap3map4core8get_hashTNtNtNtCsbXszlfw18sr_12rustc_middle2ty9predicate6ClauseNtNtCs7oA9ExUwCrc_10rustc_span13span_encoding4SpanEuE0ECs5HL0smY5QW1_18rustc_hir
        13: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
        14: <rustc_hir_analysis::autoderef::Autoderef>::new
        15: <rustc_hir_analysis::autoderef::Autoderef>::new
        16: RINvMs6_NtCs7GOy6fm2oBU_9hashbrown3rawINtB6_8RawTableTTNtNtNtCsbXszlfw18sr_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs4KW7ZBCgaGA_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
        17: rustc_query_impl::plumbing::query_key_hash_verify_all
        18: RINvNtNtCs4KW7ZBCgaGA_18rustc_query_system5query8plumbing17try_execute_queryINtCs3NgWbJct2sR_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCsbXszlfw18sr_12rustc_middle5query5erase6ErasedAhj18_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        19: rustc_query_impl::plumbing::query_key_hash_verify_all
        20: rustc_hir_analysis::check_crate
        21: <rustc_hir_analysis::autoderef::Autoderef>::new
        22: <rustc_lint::builtin::SpecialModuleName as rustc_lint::passes::EarlyLintPass>::check_crate
        23: RINvNtNtCs4KW7ZBCgaGA_18rustc_query_system5query8plumbing17try_execute_queryINtCs3NgWbJct2sR_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsbXszlfw18sr_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        24: rustc_query_impl::profiling_support::alloc_self_profile_query_strings
        25: <rustc_hir_analysis::autoderef::Autoderef>::new
        26: RINvMs6_NtCs7GOy6fm2oBU_9hashbrown3rawINtB6_8RawTableTTNtNtNtCsbXszlfw18sr_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs4KW7ZBCgaGA_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
        27: rustc_query_impl::plumbing::query_key_hash_verify_all
        28: RINvNtNtCs4KW7ZBCgaGA_18rustc_query_system5query8plumbing17try_execute_queryINtCs3NgWbJct2sR_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCsbXszlfw18sr_12rustc_middle5query5erase6ErasedAhj10_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        29: rustc_query_impl::plumbing::query_key_hash_verify_all
        30: rustc_hir_analysis::check::check_function_signature
        31: rustc_hir_analysis::hir_ty_lowering::generics::check_generic_arg_count_for_call
        32: rustc_hir_analysis::check::check::check_abi
        33: RINvMs6_NtCs7GOy6fm2oBU_9hashbrown3rawINtB6_8RawTableTTNtNtNtCsbXszlfw18sr_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs4KW7ZBCgaGA_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
        34: RINvNtNtCs4KW7ZBCgaGA_18rustc_query_system5query8plumbing17try_execute_queryINtCs3NgWbJct2sR_16rustc_query_impl13DynamicConfigINtNtCseAq6incT63V_21rustc_data_structures9vec_cache8VecCacheNtNtCs7oA9ExUwCrc_10rustc_span6def_id10LocalDefIdINtNtNtCsbXszlfw18sr
        35: rustc_query_impl::plumbing::query_key_hash_verify_all
        36: rustc_hir_analysis::check::check::check_abi
        37: <rustc_lint::builtin::SpecialModuleName as rustc_lint::passes::EarlyLintPass>::check_crate
        38: RINvNtNtCs4KW7ZBCgaGA_18rustc_query_system5query8plumbing17try_execute_queryINtCs3NgWbJct2sR_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsbXszlfw18sr_12rustc_middle5query5erase6ErasedAhj1_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        39: rustc_query_impl::profiling_support::alloc_self_profile_query_strings
        40: rustc_hir_analysis::check_crate
        41: rustc_interface::passes::analysis
        42: <rustc_lint::builtin::SpecialModuleName as rustc_lint::passes::EarlyLintPass>::check_crate
        43: RINvNtNtCs4KW7ZBCgaGA_18rustc_query_system5query8plumbing17try_execute_queryINtCs3NgWbJct2sR_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsbXszlfw18sr_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        44: rustc_query_impl::profiling_support::alloc_self_profile_query_strings
        45: std::sys::backtrace::__rust_begin_short_backtrace::<std::thread::lifecycle::spawn_unchecked<ctrlc::set_handler_inner<rustc_driver_impl::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
        46: RINvNtNtCsaVqoImmYiGb_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsfv2UbmTIvQU_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCsg5DqpeyVLI8_17rustc_driver_i
        47: std::sys::backtrace::__rust_begin_short_backtrace::<std::thread::lifecycle::spawn_unchecked<ctrlc::set_handler_inner<rustc_driver_impl::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
        48: std::sys::thread::windows::impl$0::new::thread_start
                   at /rustc/37aa2135b5d0936bd13aa699d941aaa94fbaa645/library\std\src\sys\thread\windows.rs:59
        49: BaseThreadInitThunk
        50: RtlUserThreadStart

  --> src/main.rs:11:20
   |
11 |     fn foo(_: [u8; Foo::X]) {}
   |                    ^^^

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

@rustbot label +F-min_generic_const_args +F-inherent_associated_types

Metadata

Metadata

Assignees

No one assigned

    Labels

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