Skip to content

ICE: unelided lifetime in signature #138131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matthiaskrgr opened this issue Mar 6, 2025 · 0 comments · May be fixed by #140247
Open

ICE: unelided lifetime in signature #138131

matthiaskrgr opened this issue Mar 6, 2025 · 0 comments · May be fixed by #140247
Labels
C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` F-min_generic_const_args `#![feature(min_generic_const_args)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#![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() {}

original:

struct Foo<'a> { x: &'a () }

impl<'a> Foo<'a> {
    const X: usize = 0;

    fn foo(_: [u8; Foo::X]) {}
}


fn main() {}

Version information

rustc 1.87.0-nightly (e6af292f9 2025-03-06)
binary: rustc
commit-hash: e6af292f91f21f12ac1aab6825efb7e1e3381cbb
commit-date: 2025-03-06
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(min_generic_const_args) -Zcrate-attr=feature(inherent_associated_types)

Program output

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:9
  |
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
 --> <crate attribute>:1:9
  |
1 | 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.6nb7eU6SZYdW/rustc_testrunner_tmpdir_reporting.kLVtKi15t0YT/mvce.rs:1:8
  |
1 | struct Foo<'a> {
  |        ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: associated function `foo` is never used
 --> /tmp/icemaker_global_tempdir.6nb7eU6SZYdW/rustc_testrunner_tmpdir_reporting.kLVtKi15t0YT/mvce.rs:6:8
  |
5 | impl<'a> Foo<'a> {
  | ---------------- associated function in this implementation
6 |     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.6nb7eU6SZYdW/rustc_testrunner_tmpdir_reporting.kLVtKi15t0YT/mvce.rs:6:20
  |
6 |     fn foo(_: [u8; Foo::X]) {}
  |                    ^^^
  |
note: delayed at compiler/rustc_hir_analysis/src/collect.rs:417: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_path
         6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
         7: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_const_arg
         8: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
         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_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>>
        17: <rustc_hir_analysis::variance::constraints::ConstraintContext>::build_constraints_for_item
        18: rustc_hir_analysis::variance::crate_variances
        19: 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]>>
        20: 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>
        21: rustc_query_impl::query_impl::crate_variances::get_query_non_incr::__rust_end_short_backtrace
        22: rustc_hir_analysis::variance::variances_of
        23: 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]>>
        24: <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
        25: 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>
        26: rustc_query_impl::query_impl::variances_of::get_query_non_incr::__rust_end_short_backtrace
        27: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 16]>>>
        28: rustc_hir_analysis::check::wfcheck::check_variances_for_type_defn
        29: rustc_hir_analysis::check::wfcheck::check_well_formed
        30: 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]>>
        31: 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>
        32: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
        33: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
        34: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        35: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        36: rustc_query_impl::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
        37: rustc_hir_analysis::check_crate
        38: rustc_interface::passes::run_required_analyses
        39: rustc_interface::passes::analysis
        40: 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]>>
        41: 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>
        42: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        43: 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}::{closure#0}
        44: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        45: 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}, ()>
        46: <<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}
        47: std::sys::pal::unix::thread::Thread::new::thread_start
        48: <unknown>
        49: <unknown>
 --> /tmp/icemaker_global_tempdir.6nb7eU6SZYdW/rustc_testrunner_tmpdir_reporting.kLVtKi15t0YT/mvce.rs:6:20
  |
6 |     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.87.0-nightly (e6af292f9 2025-03-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(min_generic_const_args) -Z crate-attr=feature(inherent_associated_types) -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@rustbot label +F-min_generic_const_args +F-inherent_associated_types

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 6, 2025
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-inherent_associated_types `#![feature(inherent_associated_types)]` F-min_generic_const_args `#![feature(min_generic_const_args)]` labels Mar 6, 2025
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Mar 9, 2025
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` F-min_generic_const_args `#![feature(min_generic_const_args)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants