Skip to content

ICE: cannot relate region: LUB(ReErased, ReError) #109178

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#![crate_type = "lib"]
#![feature(adt_const_params, generic_const_exprs)]

struct Changes<const CHANGES: &[&'static str]>
where
    [(); CHANGES.len()]:, {}

impl<const CHANGES: &[&str]> Changes<CHANGES> where [(); CHANGES.len()]: {}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (171693274 2023-03-14)
binary: rustc
commit-hash: 1716932743a7b3705cbf0c34db0c4e070ed1930d
commit-date: 2023-03-14
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

error[E0637]: `&` without an explicit lifetime name cannot be used here
 --> treereduce.out:4:31
  |
4 | struct Changes<const CHANGES: &[&'static str]>
  |                               ^ explicit lifetime name needed here

error[E0637]: `&` without an explicit lifetime name cannot be used here
 --> treereduce.out:8:21
  |
8 | impl<const CHANGES: &[&str]> Changes<CHANGES> where [(); CHANGES.len()]: {}
  |                     ^ explicit lifetime name needed here

error[E0637]: `&` without an explicit lifetime name cannot be used here
 --> treereduce.out:8:23
  |
8 | impl<const CHANGES: &[&str]> Changes<CHANGES> where [(); CHANGES.len()]: {}
  |                       ^ explicit lifetime name needed here

warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
 --> treereduce.out:2:12
  |
2 | #![feature(adt_const_params, generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^
  |
  = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> treereduce.out:2:30
  |
2 | #![feature(adt_const_params, generic_const_exprs)]
  |                              ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
Backtrace


error: internal compiler error: compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:546:17: cannot relate region: LUB(ReErased, ReError)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7f9b4036651a - std::backtrace_rs::backtrace::libunwind::trace::hb525d69e070ade81
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9b4036651a - std::backtrace_rs::backtrace::trace_unsynchronized::hc013ba6c022c8cc0
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9b4036651a - std::sys_common::backtrace::_print_fmt::hc99069d428720acc
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9b4036651a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6b2dfd5fb54878e3
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9b403c9c5e - core::fmt::write::he277a08b33a83db8
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f9b40359375 - std::io::Write::write_fmt::h6a5aa3320aae0280
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/io/mod.rs:1684:15
   6:     0x7f9b403662e5 - std::sys_common::backtrace::_print::h763b5adb4e9083ff
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f9b403662e5 - std::sys_common::backtrace::print::h5a4028b32a3df8a2
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f9b4036905f - std::panicking::default_hook::{{closure}}::h0c8c81b9641f8819
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:271:22
   9:     0x7f9b40368d9b - std::panicking::default_hook::h5bf7cd33f355743b
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:290:9
  10:     0x7f9b436577f5 - rustc_driver_impl[aa1a5107c9e4d916]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f9b4036989d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h31d3f61cac634989
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/alloc/src/boxed.rs:2002:9
  12:     0x7f9b4036989d - std::panicking::rust_panic_with_hook::h11aed2986f5c5154
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:696:13
  13:     0x7f9b43bc5ee1 - std[8d53a76fa3b550eb]::panicking::begin_panic::<rustc_errors[8599a23c87e09326]::ExplicitBug>::{closure#0}
  14:     0x7f9b43bc15f6 - std[8d53a76fa3b550eb]::sys_common::backtrace::__rust_end_short_backtrace::<std[8d53a76fa3b550eb]::panicking::begin_panic<rustc_errors[8599a23c87e09326]::ExplicitBug>::{closure#0}, !>
  15:     0x7f9b43c46796 - std[8d53a76fa3b550eb]::panicking::begin_panic::<rustc_errors[8599a23c87e09326]::ExplicitBug>
  16:     0x7f9b43c12716 - std[8d53a76fa3b550eb]::panic::panic_any::<rustc_errors[8599a23c87e09326]::ExplicitBug>
  17:     0x7f9b43c0ef96 - <rustc_errors[8599a23c87e09326]::HandlerInner>::bug::<&alloc[d8d2767b3a5246a6]::string::String>
  18:     0x7f9b43c0ec60 - <rustc_errors[8599a23c87e09326]::Handler>::bug::<&alloc[d8d2767b3a5246a6]::string::String>
  19:     0x7f9b43bfb15b - rustc_middle[91c99f5af0859808]::util::bug::opt_span_bug_fmt::<rustc_span[3a8ff7714ec0cd56]::span_encoding::Span>::{closure#0}
  20:     0x7f9b43bf9bba - rustc_middle[91c99f5af0859808]::ty::context::tls::with_opt::<rustc_middle[91c99f5af0859808]::util::bug::opt_span_bug_fmt<rustc_span[3a8ff7714ec0cd56]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f9b43bf9b86 - rustc_middle[91c99f5af0859808]::ty::context::tls::with_context_opt::<rustc_middle[91c99f5af0859808]::ty::context::tls::with_opt<rustc_middle[91c99f5af0859808]::util::bug::opt_span_bug_fmt<rustc_span[3a8ff7714ec0cd56]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9b43bfb0a6 - rustc_middle[91c99f5af0859808]::util::bug::opt_span_bug_fmt::<rustc_span[3a8ff7714ec0cd56]::span_encoding::Span>
  23:     0x7f9b41d3dae3 - rustc_middle[91c99f5af0859808]::util::bug::bug_fmt
  24:     0x7f9b41738c4c - <rustc_infer[6c3ddf86a7b5630a]::infer::lexical_region_resolve::LexicalResolver>::lub_concrete_regions
  25:     0x7f9b417358d5 - rustc_infer[6c3ddf86a7b5630a]::infer::lexical_region_resolve::resolve
  26:     0x7f9b42608ded - <rustc_infer[6c3ddf86a7b5630a]::infer::error_reporting::TypeErrCtxt>::check_region_obligations_and_report_errors
  27:     0x7f9b425ec959 - rustc_hir_analysis[2cd7f2356faca1ef]::check::wfcheck::check_well_formed
  28:     0x7f9b41ace30d - rustc_query_system[d086d80e7946fec]::query::plumbing::try_execute_query::<rustc_query_impl[4365cf0f327aa4bf]::queries::check_well_formed, rustc_query_impl[4365cf0f327aa4bf]::plumbing::QueryCtxt>
  29:     0x7f9b42b3e312 - rustc_data_structures[fc6c1c49e6433a48]::sync::par_for_each_in::<&[rustc_hir[2286395576989f03]::hir::ItemId], <rustc_middle[91c99f5af0859808]::hir::ModuleItems>::par_items<rustc_hir_analysis[2cd7f2356faca1ef]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  30:     0x7f9b42b3ded0 - rustc_hir_analysis[2cd7f2356faca1ef]::check::wfcheck::check_mod_type_wf
  31:     0x7f9b42c9b2ce - rustc_query_system[d086d80e7946fec]::query::plumbing::try_execute_query::<rustc_query_impl[4365cf0f327aa4bf]::queries::check_mod_type_wf, rustc_query_impl[4365cf0f327aa4bf]::plumbing::QueryCtxt>
  32:     0x7f9b42c9ae53 - <rustc_query_impl[4365cf0f327aa4bf]::Queries as rustc_middle[91c99f5af0859808]::ty::query::QueryEngine>::check_mod_type_wf
  33:     0x7f9b41a1f778 - rustc_data_structures[fc6c1c49e6433a48]::sync::par_for_each_in::<&[rustc_hir[2286395576989f03]::hir_id::OwnerId], <rustc_middle[91c99f5af0859808]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[2cd7f2356faca1ef]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  34:     0x7f9b41a1f600 - <rustc_session[66f881e4886b517]::session::Session>::track_errors::<rustc_hir_analysis[2cd7f2356faca1ef]::check_crate::{closure#5}, ()>
  35:     0x7f9b41a1c830 - rustc_hir_analysis[2cd7f2356faca1ef]::check_crate
  36:     0x7f9b41a145e2 - rustc_interface[92ae9247c658ed28]::passes::analysis
  37:     0x7f9b42e7b95c - rustc_query_system[d086d80e7946fec]::query::plumbing::try_execute_query::<rustc_query_impl[4365cf0f327aa4bf]::queries::analysis, rustc_query_impl[4365cf0f327aa4bf]::plumbing::QueryCtxt>
  38:     0x7f9b42e7b650 - <rustc_query_impl[4365cf0f327aa4bf]::Queries as rustc_middle[91c99f5af0859808]::ty::query::QueryEngine>::analysis
  39:     0x7f9b42ca3369 - <rustc_middle[91c99f5af0859808]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>
  40:     0x7f9b4287cfa8 - rustc_span[3a8ff7714ec0cd56]::with_source_map::<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_interface[92ae9247c658ed28]::interface::run_compiler<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  41:     0x7f9b4287420c - std[8d53a76fa3b550eb]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[92ae9247c658ed28]::util::run_in_thread_pool_with_globals<rustc_interface[92ae9247c658ed28]::interface::run_compiler<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}>::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>
  42:     0x7f9b42873c3a - <<std[8d53a76fa3b550eb]::thread::Builder>::spawn_unchecked_<rustc_interface[92ae9247c658ed28]::util::run_in_thread_pool_with_globals<rustc_interface[92ae9247c658ed28]::interface::run_compiler<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}>::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>::{closure#1} as core[93f4c45d685c579b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7f9b40373793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb296ec1752427222
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/alloc/src/boxed.rs:1988:9
  44:     0x7f9b40373793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha3d23d73a848aedf
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/alloc/src/boxed.rs:1988:9
  45:     0x7f9b40373793 - std::sys::unix::thread::Thread::new::thread_start::hdf09fab72a35a799
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys/unix/thread.rs:108:17
  46:     0x7f9b40105bb5 - <unknown>
  47:     0x7f9b40187d90 - <unknown>
  48:                0x0 - <unknown>

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: rustc 1.70.0-nightly (171693274 2023-03-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_well_formed] checking that `<impl at treereduce.out:8:1: 8:46>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 2 warnings emitted

For more information about this error, try `rustc --explain E0637`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions