Skip to content
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

ICE with GAT and TAIT: cannot relate region: LUB(ReEarlyBound(0, 'a), ReErased) #101940

Closed
yshui opened this issue Sep 17, 2022 · 2 comments · Fixed by #103008
Closed

ICE with GAT and TAIT: cannot relate region: LUB(ReEarlyBound(0, 'a), ReErased) #101940

yshui opened this issue Sep 17, 2022 · 2 comments · Fixed by #103008
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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.

Comments

@yshui
Copy link
Contributor

yshui commented Sep 17, 2022

Code

pub trait Trait {
    type Fut<'a> where Self: 'a;
    fn fun<'a, 'b>(&'a self, x: &'_ mut &'b ()) -> Self::Fut<'a>
    where
        'b: 'a;
}
impl Trait for () {
    type Fut<'a> = impl ::std::future::Future + 'a
    where
        Self: 'a;
    fn fun<'a, 'b>(&'a self, x: &'_ mut &'b ()) -> Self::Fut<'a>
    where
        'b: 'a,
    {
        async { }
    }
}

Meta


Regression in 2287107 (#98559)


searched nightlies: from nightly-2022-09-09 to nightly-2022-09-15
regressed nightly: nightly-2022-09-11
searched commit range: 1d37ed6...2287107
regressed commit: 2287107

bisected with cargo-bisect-rustc v0.6.4

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc ice --prompt
Backtrace

error: internal compiler error: compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:536:17: cannot relate region: LUB(ReEarlyBound(0, 'a), ReErased)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/compiler/rustc_errors/src/lib.rs:1458:9
stack backtrace:
   0:     0x7f5e49799c20 - std::backtrace_rs::backtrace::libunwind::trace::hf9cd4c385c25a2fe
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f5e49799c20 - std::backtrace_rs::backtrace::trace_unsynchronized::hf9a1be2df46de98c
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5e49799c20 - std::sys_common::backtrace::_print_fmt::ha770a6c3890b3cde
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f5e49799c20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7099a61d18d47f5f
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f5e497f4aee - core::fmt::write::h34c269a5556240be
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f5e4978a835 - std::io::Write::write_fmt::h9b1d898decaac979
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/io/mod.rs:1679:15
   6:     0x7f5e4979c8d3 - std::sys_common::backtrace::_print::hb8325cbd910e0a42
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f5e4979c8d3 - std::sys_common::backtrace::print::h52eaf8f4259fb854
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f5e4979c8d3 - std::panicking::default_hook::{{closure}}::h38a1bd1ceb333281
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/panicking.rs:295:22
   9:     0x7f5e4979c5bf - std::panicking::default_hook::hbfa37b6c2aa83708
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/panicking.rs:314:9
  10:     0x7f5e4c003001 - <rustc_driver[f7b5b01335fbd434]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[f6f8d9be6066ab2c]::ops::function::FnOnce<(&core[f6f8d9be6066ab2c]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f5e4979d10d - std::panicking::rust_panic_with_hook::h6bfc21eea1a19790
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/panicking.rs:702:17
  12:     0x7f5e4d02b081 - std[81ab5d9a96a0142e]::panicking::begin_panic::<rustc_errors[e78c9e9af74db21c]::ExplicitBug>::{closure#0}
  13:     0x7f5e4d02a296 - std[81ab5d9a96a0142e]::sys_common::backtrace::__rust_end_short_backtrace::<std[81ab5d9a96a0142e]::panicking::begin_panic<rustc_errors[e78c9e9af74db21c]::ExplicitBug>::{closure#0}, !>
  14:     0x7f5e4cfb1a06 - std[81ab5d9a96a0142e]::panicking::begin_panic::<rustc_errors[e78c9e9af74db21c]::ExplicitBug>
  15:     0x7f5e4d028976 - std[81ab5d9a96a0142e]::panic::panic_any::<rustc_errors[e78c9e9af74db21c]::ExplicitBug>
  16:     0x7f5e4d025c0d - <rustc_errors[e78c9e9af74db21c]::HandlerInner>::bug::<&alloc[9d62437589f31483]::string::String>
  17:     0x7f5e4d0254c0 - <rustc_errors[e78c9e9af74db21c]::Handler>::bug::<&alloc[9d62437589f31483]::string::String>
  18:     0x7f5e4d0a5d3d - rustc_middle[af3205fb0fe14459]::ty::context::tls::with_context_opt::<rustc_middle[af3205fb0fe14459]::ty::context::tls::with_opt<rustc_middle[af3205fb0fe14459]::util::bug::opt_span_bug_fmt<rustc_span[352514dd70ceaa1d]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  19:     0x7f5e4d0a6a36 - rustc_middle[af3205fb0fe14459]::util::bug::opt_span_bug_fmt::<rustc_span[352514dd70ceaa1d]::span_encoding::Span>
  20:     0x7f5e4aa61fb3 - rustc_middle[af3205fb0fe14459]::util::bug::bug_fmt
  21:     0x7f5e4ab19997 - <rustc_infer[29b444941ee7ee25]::infer::lexical_region_resolve::LexicalResolver>::lub_concrete_regions
  22:     0x7f5e4ab1694b - rustc_infer[29b444941ee7ee25]::infer::lexical_region_resolve::resolve
  23:     0x7f5e4b4be94b - <rustc_infer[29b444941ee7ee25]::infer::InferCtxt>::resolve_regions_and_report_errors
  24:     0x7f5e4b4a7e6a - <rustc_infer[29b444941ee7ee25]::infer::InferCtxt>::check_region_obligations_and_report_errors
  25:     0x7f5e4b9580b5 - <rustc_infer[29b444941ee7ee25]::infer::InferCtxtBuilder>::enter::<(), rustc_typeck[a12c0d1dcfa26d23]::check::check::check_opaque_meets_bounds::{closure#0}>
  26:     0x7f5e4b931987 - rustc_typeck[a12c0d1dcfa26d23]::check::check::check_item_type
  27:     0x7f5e4b92e47e - rustc_typeck[a12c0d1dcfa26d23]::check::check::check_mod_item_types
  28:     0x7f5e4b129771 - <rustc_query_system[d9fae65d8b1eb5ad]::dep_graph::graph::DepGraph<rustc_middle[af3205fb0fe14459]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[af3205fb0fe14459]::ty::context::TyCtxt, rustc_span[352514dd70ceaa1d]::def_id::LocalDefId, ()>
  29:     0x7f5e4b1281f7 - rustc_query_system[d9fae65d8b1eb5ad]::query::plumbing::try_execute_query::<rustc_query_impl[1a54d4e1bcc8b675]::plumbing::QueryCtxt, rustc_query_system[d9fae65d8b1eb5ad]::query::caches::DefaultCache<rustc_span[352514dd70ceaa1d]::def_id::LocalDefId, ()>>
  30:     0x7f5e4ba7e039 - rustc_query_system[d9fae65d8b1eb5ad]::query::plumbing::get_query::<rustc_query_impl[1a54d4e1bcc8b675]::queries::check_mod_item_types, rustc_query_impl[1a54d4e1bcc8b675]::plumbing::QueryCtxt>
  31:     0x7f5e4bd1a50c - <rustc_middle[af3205fb0fe14459]::hir::map::Map>::for_each_module::<rustc_typeck[a12c0d1dcfa26d23]::check_crate::{closure#6}::{closure#0}>
  32:     0x7f5e4b314435 - rustc_typeck[a12c0d1dcfa26d23]::check_crate
  33:     0x7f5e4b313a27 - rustc_interface[5bcac5cfb78c3b1a]::passes::analysis
  34:     0x7f5e4bdcd852 - <rustc_query_system[d9fae65d8b1eb5ad]::dep_graph::graph::DepGraph<rustc_middle[af3205fb0fe14459]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[af3205fb0fe14459]::ty::context::TyCtxt, (), core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>
  35:     0x7f5e4bdccf1a - rustc_query_system[d9fae65d8b1eb5ad]::query::plumbing::try_execute_query::<rustc_query_impl[1a54d4e1bcc8b675]::plumbing::QueryCtxt, rustc_query_system[d9fae65d8b1eb5ad]::query::caches::DefaultCache<(), core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>>
  36:     0x7f5e4bdcc9e7 - rustc_query_system[d9fae65d8b1eb5ad]::query::plumbing::get_query::<rustc_query_impl[1a54d4e1bcc8b675]::queries::analysis, rustc_query_impl[1a54d4e1bcc8b675]::plumbing::QueryCtxt>
  37:     0x7f5e4adfaeb7 - <rustc_interface[5bcac5cfb78c3b1a]::passes::QueryContext>::enter::<rustc_driver[f7b5b01335fbd434]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>
  38:     0x7f5e4adee8cc - rustc_interface[5bcac5cfb78c3b1a]::interface::create_compiler_and_run::<core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>, rustc_driver[f7b5b01335fbd434]::run_compiler::{closure#1}>
  39:     0x7f5e4aded211 - <scoped_tls[de48490ce358b7ec]::ScopedKey<rustc_span[352514dd70ceaa1d]::SessionGlobals>>::set::<rustc_interface[5bcac5cfb78c3b1a]::interface::run_compiler<core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>, rustc_driver[f7b5b01335fbd434]::run_compiler::{closure#1}>::{closure#0}, core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>
  40:     0x7f5e4adeceff - std[81ab5d9a96a0142e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5bcac5cfb78c3b1a]::util::run_in_thread_pool_with_globals<rustc_interface[5bcac5cfb78c3b1a]::interface::run_compiler<core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>, rustc_driver[f7b5b01335fbd434]::run_compiler::{closure#1}>::{closure#0}, core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>::{closure#0}, core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>
  41:     0x7f5e4be67000 - <<std[81ab5d9a96a0142e]::thread::Builder>::spawn_unchecked_<rustc_interface[5bcac5cfb78c3b1a]::util::run_in_thread_pool_with_globals<rustc_interface[5bcac5cfb78c3b1a]::interface::run_compiler<core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>, rustc_driver[f7b5b01335fbd434]::run_compiler::{closure#1}>::{closure#0}, core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>::{closure#0}, core[f6f8d9be6066ab2c]::result::Result<(), rustc_errors[e78c9e9af74db21c]::ErrorGuaranteed>>::{closure#1} as core[f6f8d9be6066ab2c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f5e497a6ee3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2695b43ebae659e4
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/alloc/src/boxed.rs:1940:9
  43:     0x7f5e497a6ee3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf3b49b955267341c
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/alloc/src/boxed.rs:1940:9
  44:     0x7f5e497a6ee3 - std::sys::unix::thread::Thread::new::thread_start::h2bad5ab8a769c6c8
                               at /rustc/750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c/library/std/src/sys/unix/thread.rs:108:17
  45:     0x7f5e494f46a3 - <unknown>
  46:     0x7f5e4957a52c - <unknown>
  47:                0x0 - <unknown>

@yshui yshui 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 Sep 17, 2022
@yshui
Copy link
Contributor Author

yshui commented Sep 17, 2022

Before the ICE regression, the error message was.. pretty weird:

error[E0478]: lifetime bound not satisfied
 --> src/lib.rs:9:20
  |
9 |     type Fut<'a> = impl ::std::future::Future + 'a
  |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: lifetime parameter instantiated with the empty lifetime
note: but lifetime parameter must outlive the lifetime `'a` as defined here
 --> src/lib.rs:9:14
  |
9 |     type Fut<'a> = impl ::std::future::Future + 'a
  |              ^^

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

@yshui
Copy link
Contributor Author

yshui commented Sep 17, 2022

Ok, I think this is duplicate of #100267

matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Sep 23, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 1, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 13, 2022
…li-obk

replace ReErased with fresh region vars in opaque types

See inline comments.

Prior art rust-lang#102943. cc `@compiler-errors` `@oli-obk`

Fixes rust-lang#100267
Fixes rust-lang#101940
Fixes rust-lang#102649
Fixes rust-lang#102510
@bors bors closed this as completed in 059bbf7 Oct 14, 2022
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. glacier ICE tracked in rust-lang/glacier. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants