Skip to content

ICE: cannot relate region: ReError #107988

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

pub trait TraitEngine<'tcx>: 'tcx {}

pub trait TraitEngineExt<'tcx> {
    fn register_predicate_obligations(&mut self);
}

impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
    fn register_predicate_obligations(&mut self) {}
}

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (585f3eef2 2023-02-11)
binary: rustc
commit-hash: 585f3eef26f04440bca726c29193af7b4fa90e54
commit-date: 2023-02-11
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

error[E0261]: use of undeclared lifetime name `'tcx`
 --> a4509c69b3c0565553c2eab2b77a35e207f6584e.rs:7:52
  |
7 | impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
  |      -                                             ^^^^ undeclared lifetime
  |      |
  |      help: consider introducing lifetime `'tcx` here: `'tcx,`

error[E0261]: use of undeclared lifetime name `'tcx`
 --> a4509c69b3c0565553c2eab2b77a35e207f6584e.rs:7:30
  |
7 | impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
  |                              ^^^^ undeclared lifetime
  |
  = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider making the bound lifetime-generic with a new `'tcx` lifetime
  |
7 | impl<T: ?Sized + for<'tcx> TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
  |                  +++++++++
help: consider introducing lifetime `'tcx` here
  |
7 | impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
  |      +++++

error[E0601]: `main` function not found in crate `a4509c69b3c0565553c2eab2b77a35e207f6584e`
 --> a4509c69b3c0565553c2eab2b77a35e207f6584e.rs:9:2
  |
9 | }
  |  ^ consider adding a `main` function to `a4509c69b3c0565553c2eab2b77a35e207f6584e.rs`
Backtrace


error: internal compiler error: compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:471:25: cannot relate region: ReError

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7fab7dd6a38a - std::backtrace_rs::backtrace::libunwind::trace::h096bc109d8146b78
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fab7dd6a38a - std::backtrace_rs::backtrace::trace_unsynchronized::h078668221a105455
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fab7dd6a38a - std::sys_common::backtrace::_print_fmt::h713fa4a6d854cf5c
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fab7dd6a38a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6d63b1361ac269d9
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fab7ddca63e - core::fmt::write::h686d8700d86d4c63
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/core/src/fmt/mod.rs:1232:17
   5:     0x7fab7dd5aaa5 - std::io::Write::write_fmt::hb709f37ae1a5c85f
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/io/mod.rs:1684:15
   6:     0x7fab7dd6a155 - std::sys_common::backtrace::_print::h45f3ea51978b5c4e
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fab7dd6a155 - std::sys_common::backtrace::print::h49497d08a85a9022
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fab7dd6ceef - std::panicking::default_hook::{{closure}}::h7a6e4798a697173c
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/panicking.rs:267:22
   9:     0x7fab7dd6cc2b - std::panicking::default_hook::h37ad6e19f54e7e47
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/panicking.rs:286:9
  10:     0x7fab810bd454 - <rustc_driver_impl[c6f3d1f18e4c482b]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[652be0d07939784a]::ops::function::FnOnce<(&core[652be0d07939784a]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fab7dd6d72a - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h125997bc4c9049ad
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/alloc/src/boxed.rs:2002:9
  12:     0x7fab7dd6d72a - std::panicking::rust_panic_with_hook::hbb26fd9c41e82da0
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/panicking.rs:692:13
  13:     0x7fab8163b781 - std[79537e01b24f4e57]::panicking::begin_panic::<rustc_errors[ca74678be89463ea]::ExplicitBug>::{closure#0}
  14:     0x7fab8163b326 - std[79537e01b24f4e57]::sys_common::backtrace::__rust_end_short_backtrace::<std[79537e01b24f4e57]::panicking::begin_panic<rustc_errors[ca74678be89463ea]::ExplicitBug>::{closure#0}, !>
  15:     0x7fab815f4b36 - std[79537e01b24f4e57]::panicking::begin_panic::<rustc_errors[ca74678be89463ea]::ExplicitBug>
  16:     0x7fab81658fd6 - std[79537e01b24f4e57]::panic::panic_any::<rustc_errors[ca74678be89463ea]::ExplicitBug>
  17:     0x7fab81656c96 - <rustc_errors[ca74678be89463ea]::HandlerInner>::bug::<&alloc[7494bfde885254a9]::string::String>
  18:     0x7fab81656970 - <rustc_errors[ca74678be89463ea]::Handler>::bug::<&alloc[7494bfde885254a9]::string::String>
  19:     0x7fab81675ebb - rustc_middle[1c3eb348322c823d]::util::bug::opt_span_bug_fmt::<rustc_span[8d7f704d44180a8e]::span_encoding::Span>::{closure#0}
  20:     0x7fab8167518a - rustc_middle[1c3eb348322c823d]::ty::context::tls::with_opt::<rustc_middle[1c3eb348322c823d]::util::bug::opt_span_bug_fmt<rustc_span[8d7f704d44180a8e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fab81675156 - rustc_middle[1c3eb348322c823d]::ty::context::tls::with_context_opt::<rustc_middle[1c3eb348322c823d]::ty::context::tls::with_opt<rustc_middle[1c3eb348322c823d]::util::bug::opt_span_bug_fmt<rustc_span[8d7f704d44180a8e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fab81675e06 - rustc_middle[1c3eb348322c823d]::util::bug::opt_span_bug_fmt::<rustc_span[8d7f704d44180a8e]::span_encoding::Span>
  23:     0x7fab7f418563 - rustc_middle[1c3eb348322c823d]::util::bug::bug_fmt
  24:     0x7fab7faa37be - <rustc_infer[8c1130e554b5edbf]::infer::lexical_region_resolve::LexicalResolver>::bound_is_met
  25:     0x7fab7faa36f6 - <rustc_infer[8c1130e554b5edbf]::infer::lexical_region_resolve::LexicalResolver>::bound_is_met
  26:     0x7fab7faa090d - rustc_infer[8c1130e554b5edbf]::infer::lexical_region_resolve::resolve
  27:     0x7fab7fa9f668 - <rustc_infer[8c1130e554b5edbf]::infer::InferCtxt>::resolve_regions
  28:     0x7fab7fa947c6 - rustc_hir_analysis[271b634e9df13518]::check::compare_impl_item::compare_method_predicate_entailment
  29:     0x7fab7fa8e969 - rustc_hir_analysis[271b634e9df13518]::check::compare_impl_item::compare_impl_method
  30:     0x7fab7fa80d44 - rustc_hir_analysis[271b634e9df13518]::check::check::check_mod_item_types
  31:     0x7fab8062832e - rustc_query_system[c59fc872c4b14737]::query::plumbing::try_execute_query::<rustc_query_impl[263d6446cf6bce44]::queries::check_mod_item_types, rustc_query_impl[263d6446cf6bce44]::plumbing::QueryCtxt>
  32:     0x7fab80a44d7d - <rustc_query_impl[263d6446cf6bce44]::Queries as rustc_middle[1c3eb348322c823d]::ty::query::QueryEngine>::check_mod_item_types
  33:     0x7fab8051c851 - <rustc_session[ee8a7cbbe1cd06ff]::session::Session>::time::<(), rustc_hir_analysis[271b634e9df13518]::check_crate::{closure#6}>
  34:     0x7fab80519ccd - rustc_hir_analysis[271b634e9df13518]::check_crate
  35:     0x7fab80513074 - rustc_interface[e8de17c2b5310775]::passes::analysis
  36:     0x7fab8085265d - rustc_query_system[c59fc872c4b14737]::query::plumbing::try_execute_query::<rustc_query_impl[263d6446cf6bce44]::queries::analysis, rustc_query_impl[263d6446cf6bce44]::plumbing::QueryCtxt>
  37:     0x7fab80a3d8fa - <rustc_query_impl[263d6446cf6bce44]::Queries as rustc_middle[1c3eb348322c823d]::ty::query::QueryEngine>::analysis
  38:     0x7fab8075e977 - <rustc_middle[1c3eb348322c823d]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c6f3d1f18e4c482b]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>>
  39:     0x7fab802c9598 - <rustc_interface[e8de17c2b5310775]::interface::Compiler>::enter::<rustc_driver_impl[c6f3d1f18e4c482b]::run_compiler::{closure#1}::{closure#2}, core[652be0d07939784a]::result::Result<core[652be0d07939784a]::option::Option<rustc_interface[e8de17c2b5310775]::queries::Linker>, rustc_errors[ca74678be89463ea]::ErrorGuaranteed>>
  40:     0x7fab802c4714 - rustc_span[8d7f704d44180a8e]::with_source_map::<core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>, rustc_interface[e8de17c2b5310775]::interface::run_compiler<core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>, rustc_driver_impl[c6f3d1f18e4c482b]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  41:     0x7fab802c4224 - <scoped_tls[655d5469a2b0704e]::ScopedKey<rustc_span[8d7f704d44180a8e]::SessionGlobals>>::set::<rustc_interface[e8de17c2b5310775]::interface::run_compiler<core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>, rustc_driver_impl[c6f3d1f18e4c482b]::run_compiler::{closure#1}>::{closure#0}, core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>>
  42:     0x7fab802c3922 - std[79537e01b24f4e57]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e8de17c2b5310775]::util::run_in_thread_pool_with_globals<rustc_interface[e8de17c2b5310775]::interface::run_compiler<core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>, rustc_driver_impl[c6f3d1f18e4c482b]::run_compiler::{closure#1}>::{closure#0}, core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>>
  43:     0x7fab8095bdec - <<std[79537e01b24f4e57]::thread::Builder>::spawn_unchecked_<rustc_interface[e8de17c2b5310775]::util::run_in_thread_pool_with_globals<rustc_interface[e8de17c2b5310775]::interface::run_compiler<core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>, rustc_driver_impl[c6f3d1f18e4c482b]::run_compiler::{closure#1}>::{closure#0}, core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[652be0d07939784a]::result::Result<(), rustc_errors[ca74678be89463ea]::ErrorGuaranteed>>::{closure#1} as core[652be0d07939784a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7fab7dd776c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hafce49753283d4e8
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/alloc/src/boxed.rs:1988:9
  45:     0x7fab7dd776c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h52ef1a48060e9973
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/alloc/src/boxed.rs:1988:9
  46:     0x7fab7dd776c3 - std::sys::unix::thread::Thread::new::thread_start::h1e69294c622c6f5c
                               at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7fab7db088fd - <unknown>
  48:     0x7fab7db8ad20 - <unknown>
  49:                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.69.0-nightly (585f3eef2 2023-02-11) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_item_types] checking item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0261, E0601.
For more information about an error, try `rustc --explain E0261`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions