rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.61k stars 12.48k forks source link

ICE: cannot relate region: ReError #107988

Closed matthiaskrgr closed 1 year ago

matthiaskrgr commented 1 year ago

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', /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 - ::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 - >::call_once::{shim:vtable#0} 11: 0x7fab7dd6d72a - as core::ops::function::Fn>::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::::{closure#0} 14: 0x7fab8163b326 - std[79537e01b24f4e57]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 15: 0x7fab815f4b36 - std[79537e01b24f4e57]::panicking::begin_panic:: 16: 0x7fab81658fd6 - std[79537e01b24f4e57]::panic::panic_any:: 17: 0x7fab81656c96 - ::bug::<&alloc[7494bfde885254a9]::string::String> 18: 0x7fab81656970 - ::bug::<&alloc[7494bfde885254a9]::string::String> 19: 0x7fab81675ebb - rustc_middle[1c3eb348322c823d]::util::bug::opt_span_bug_fmt::::{closure#0} 20: 0x7fab8167518a - rustc_middle[1c3eb348322c823d]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 21: 0x7fab81675156 - rustc_middle[1c3eb348322c823d]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 22: 0x7fab81675e06 - rustc_middle[1c3eb348322c823d]::util::bug::opt_span_bug_fmt:: 23: 0x7fab7f418563 - rustc_middle[1c3eb348322c823d]::util::bug::bug_fmt 24: 0x7fab7faa37be - ::bound_is_met 25: 0x7fab7faa36f6 - ::bound_is_met 26: 0x7fab7faa090d - rustc_infer[8c1130e554b5edbf]::infer::lexical_region_resolve::resolve 27: 0x7fab7fa9f668 - ::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:: 32: 0x7fab80a44d7d - ::check_mod_item_types 33: 0x7fab8051c851 - ::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:: 37: 0x7fab80a3d8fa - ::analysis 38: 0x7fab8075e977 - ::enter::> 39: 0x7fab802c9598 - ::enter::, rustc_errors[ca74678be89463ea]::ErrorGuaranteed>> 40: 0x7fab802c4714 - rustc_span[8d7f704d44180a8e]::with_source_map::, rustc_interface[e8de17c2b5310775]::interface::run_compiler, rustc_driver_impl[c6f3d1f18e4c482b]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 41: 0x7fab802c4224 - >::set::, 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_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 - <::spawn_unchecked_, 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 - as core::ops::function::FnOnce>::call_once::hafce49753283d4e8 at /rustc/585f3eef26f04440bca726c29193af7b4fa90e54/library/alloc/src/boxed.rs:1988:9 45: 0x7fab7dd776c3 - as core::ops::function::FnOnce>::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 - 48: 0x7fab7db8ad20 - 49: 0x0 - 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`. ```

lenko-d commented 1 year ago

@rustbot claim

compiler-errors commented 1 year ago

@lenko-d, are you working on this?

lenko-d commented 1 year ago

@lenko-d, are you working on this?

yes