rust-lang / rust-lang/rust

ICE `inferred lifetime in signature`

Open
#148,949 5 comments 0 reactions 1 assignee View on GitHub

@reddevilmidzy is already working on this.

Since Dec 9, 2025.

C-bug F-inherent_associated_types F-min_generic_const_args I-ICE T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

snippet:

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

impl<'a> Foo<'a> {
    fn foo(_: [u8; Foo::X]) {}
}

fn main() {}

Version information

rustc 1.93.0-nightly (c91009892 2025-11-14)
binary: rustc
commit-hash: c91009892b4cd1776d4c9d85793166612195a03d
commit-date: 2025-11-14
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5

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

Program output

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

warning: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.C4RdvOM2TnqW/rustc_testrunner_tmpdir_reporting.FKNzgy6tMw5C/mvce.rs:2:12
  |
2 | #![feature(inherent_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information

warning: struct `Foo` is never constructed
 --> /tmp/icemaker_global_tempdir.C4RdvOM2TnqW/rustc_testrunner_tmpdir_reporting.FKNzgy6tMw5C/mvce.rs:3:8
  |
3 | struct Foo<'a> {
  |        ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: associated function `foo` is never used
 --> /tmp/icemaker_global_tempdir.C4RdvOM2TnqW/rustc_testrunner_tmpdir_reporting.FKNzgy6tMw5C/mvce.rs:8:8
  |
7 | impl<'a> Foo<'a> {
  | ---------------- associated function in this implementation
8 |     fn foo(_: [u8; Foo::X]) {}
  |        ^^^

warning: 4 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.C4RdvOM2TnqW/rustc_testrunner_tmpdir_reporting.FKNzgy6tMw5C/mvce.rs:8:20
  |
8 |     fn foo(_: [u8; Foo::X]) {}
  |                    ^^^
  |
note: delayed at compiler/rustc_hir_analysis/src/collect.rs:334: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_resolved_ty_path
         6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty::{closure#0}
         7: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_const_arg
         8: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty::{closure#0}
         9: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
        10: rustc_hir_analysis::collect::lower_fn_sig_recovering_infer_ret_ty
        11: rustc_hir_analysis::collect::fn_sig
        12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::fn_sig::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
        13: <rustc_query_impl::query_impl::fn_sig::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
        14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        15: rustc_query_impl::query_impl::fn_sig::get_query_non_incr::__rust_end_short_backtrace
        16: <rustc_hir_analysis::variance::constraints::ConstraintContext>::build_constraints_for_item
        17: rustc_hir_analysis::variance::crate_variances
        18: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::crate_variances::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        20: rustc_query_impl::query_impl::crate_variances::get_query_non_incr::__rust_end_short_backtrace
        21: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::variances_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>.warm
        22: <rustc_query_impl::query_impl::variances_of::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
        23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        24: rustc_query_impl::query_impl::variances_of::get_query_non_incr::__rust_end_short_backtrace
        25: rustc_hir_analysis::check::wfcheck::check_variances_for_type_defn
        26: rustc_hir_analysis::check::check::check_item_type
        27: rustc_hir_analysis::check::wfcheck::check_well_formed
        28: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        29: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        30: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
        31: rustc_hir_analysis::check::wfcheck::check_type_wf
        32: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        34: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
        35: rustc_hir_analysis::check_crate
        36: rustc_interface::passes::analysis
        37: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        38: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        39: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        40: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
        41: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        42: 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}, ()>
        43: <<std::thread::Builder>::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}
        44: std::sys::thread::unix::Thread::new::thread_start
        45: <unknown>
        46: <unknown>
      
 --> /tmp/icemaker_global_tempdir.C4RdvOM2TnqW/rustc_testrunner_tmpdir_reporting.FKNzgy6tMw5C/mvce.rs:8:20
  |
8 |     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

note: rustc 1.93.0-nightly (c91009892 2025-11-14) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@rustbot label +F-min_generic_const_args +F-inherent_associated_types

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.