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 when attempting to return for<'y> Trait<AssocType<'y> = impl Whatever> #113481

Closed
ilyvion opened this issue Jul 8, 2023 · 1 comment · Fixed by #113575
Closed

ICE when attempting to return for<'y> Trait<AssocType<'y> = impl Whatever> #113481

ilyvion opened this issue Jul 8, 2023 · 1 comment · Fixed by #113575
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

@ilyvion
Copy link

ilyvion commented Jul 8, 2023

Code

trait Foo {
    type Bar<'x>
    where
        Self: 'x;
}

fn baz() -> impl for<'y> Foo<Bar<'y> = impl ToString> {
    42
}

impl Foo for i32 {
    type Bar<'x> = &'x str;
}

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=795395ac04289bbbcb23dbb642116c1f

Meta

rustc --version --verbose:

I only did this on the playground, but it happens there on all of
* stable 1.70
* beta 1.71.0-beta.5 (2023-07-06 f06c1b82f231401543bb)
* nightly 1.72.0-nightly (2023-07-06 85bf07972a1041b9e253)

Error output

thread 'rustc' panicked at 'assertion failed: self.scc_universes[scc] == ty::UniverseIndex::ROOT', compiler/rustc_borrowck/src/region_infer/mod.rs:811:9
stack backtrace:
   0:     0x7f3911733a71 - std::backtrace_rs::backtrace::libunwind::trace::h83338e21cbc3510e
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3911733a71 - std::backtrace_rs::backtrace::trace_unsynchronized::h1663b95366fea7e1
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3911733a71 - std::sys_common::backtrace::_print_fmt::hcb919a5390faff94
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f3911733a71 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha8e8379de0738990
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f3911799d7f - core::fmt::rt::Argument::fmt::h12cd44e59c3e03f4
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/core/src/fmt/rt.rs:138:9
   5:     0x7f3911799d7f - core::fmt::write::h0d2b2a94b10f259a
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f39117264b7 - std::io::Write::write_fmt::hf16cae54d031f42c
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/io/mod.rs:1714:15
   7:     0x7f3911733885 - std::sys_common::backtrace::_print::h7c194ea6232bf362
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f3911733885 - std::sys_common::backtrace::print::hca89cc4c64fa92f2
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f3911736663 - std::panicking::default_hook::{{closure}}::hba1423900118f107
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/panicking.rs:269:22
  10:     0x7f39117363f4 - std::panicking::default_hook::hf4868ae8eb550432
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/panicking.rs:288:9
  11:     0x7f3914a4d65b - rustc_driver_impl[5fd2fff4e2ab1b68]::install_ice_hook::{closure#0}
  12:     0x7f3911736e8e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2d28fdec3189af27
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/alloc/src/boxed.rs:2024:9
  13:     0x7f3911736e8e - std::panicking::rust_panic_with_hook::hdb6e4003315ae50a
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/panicking.rs:709:13
  14:     0x7f3911736bd1 - std::panicking::begin_panic_handler::{{closure}}::h05675051fb0f9296
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/panicking.rs:595:13
  15:     0x7f3911733ed6 - std::sys_common::backtrace::__rust_end_short_backtrace::h9866f6ab4fcd5803
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f3911736962 - rust_begin_unwind
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/panicking.rs:593:5
  17:     0x7f3911795fd3 - core::panicking::panic_fmt::h1490cb3aae65fe17
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/core/src/panicking.rs:67:14
  18:     0x7f3911796063 - core::panicking::panic::hfba00d56e7941e8b
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/core/src/panicking.rs:117:5
  19:     0x7f3913a9ecd2 - <rustc_borrowck[4725ebfa67e64d94]::region_infer::RegionInferenceContext>::solve
  20:     0x7f3913a8a79e - rustc_borrowck[4725ebfa67e64d94]::nll::compute_regions
  21:     0x7f3913a69a15 - rustc_borrowck[4725ebfa67e64d94]::do_mir_borrowck
  22:     0x7f3913a67c57 - rustc_borrowck[4725ebfa67e64d94]::mir_borrowck
  23:     0x7f3912a48e9e - rustc_query_impl[a5debbf18c9cda01]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a5debbf18c9cda01]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 8usize]>>
  24:     0x7f3912a48e6e - <rustc_query_impl[a5debbf18c9cda01]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[bcc6c1a0d905112a]::ops::function::FnOnce<(rustc_middle[6a835cc3e0a555e0]::ty::context::TyCtxt, rustc_span[330d20617ff3531a]::def_id::LocalDefId)>>::call_once
  25:     0x7f3912b6e14d - rustc_query_system[9a6651a6b626ed91]::query::plumbing::try_execute_query::<rustc_query_impl[a5debbf18c9cda01]::DynamicConfig<rustc_query_system[9a6651a6b626ed91]::query::caches::VecCache<rustc_span[330d20617ff3531a]::def_id::LocalDefId, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a5debbf18c9cda01]::plumbing::QueryCtxt, false>
  26:     0x7f39143c53e1 - rustc_query_impl[a5debbf18c9cda01]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f3913b93885 - rustc_hir_analysis[ac41804801612bf5]::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
  28:     0x7f3913b90593 - rustc_hir_analysis[ac41804801612bf5]::collect::type_of::type_of
  29:     0x7f3912b923b3 - rustc_query_impl[a5debbf18c9cda01]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a5debbf18c9cda01]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7f3912b92370 - <rustc_query_impl[a5debbf18c9cda01]::query_impl::type_of::dynamic_query::{closure#2} as core[bcc6c1a0d905112a]::ops::function::FnOnce<(rustc_middle[6a835cc3e0a555e0]::ty::context::TyCtxt, rustc_span[330d20617ff3531a]::def_id::DefId)>>::call_once
  31:     0x7f3912a48795 - rustc_query_system[9a6651a6b626ed91]::query::plumbing::try_execute_query::<rustc_query_impl[a5debbf18c9cda01]::DynamicConfig<rustc_query_system[9a6651a6b626ed91]::query::caches::DefaultCache<rustc_span[330d20617ff3531a]::def_id::DefId, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a5debbf18c9cda01]::plumbing::QueryCtxt, false>
  32:     0x7f39143b4cf3 - rustc_query_impl[a5debbf18c9cda01]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f3913888d42 - rustc_middle[6a835cc3e0a555e0]::query::plumbing::query_get_at::<rustc_query_system[9a6651a6b626ed91]::query::caches::DefaultCache<rustc_span[330d20617ff3531a]::def_id::DefId, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 8usize]>>>
  34:     0x7f391388295a - rustc_hir_analysis[ac41804801612bf5]::check::check::check_mod_item_types
  35:     0x7f39136b78ac - rustc_query_impl[a5debbf18c9cda01]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a5debbf18c9cda01]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 0usize]>>
  36:     0x7f39136b788e - <rustc_query_impl[a5debbf18c9cda01]::query_impl::check_mod_item_types::dynamic_query::{closure#2} as core[bcc6c1a0d905112a]::ops::function::FnOnce<(rustc_middle[6a835cc3e0a555e0]::ty::context::TyCtxt, rustc_span[330d20617ff3531a]::def_id::LocalDefId)>>::call_once
  37:     0x7f39130bbf0f - rustc_query_system[9a6651a6b626ed91]::query::plumbing::try_execute_query::<rustc_query_impl[a5debbf18c9cda01]::DynamicConfig<rustc_query_system[9a6651a6b626ed91]::query::caches::VecCache<rustc_span[330d20617ff3531a]::def_id::LocalDefId, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[a5debbf18c9cda01]::plumbing::QueryCtxt, false>
  38:     0x7f39143b8144 - rustc_query_impl[a5debbf18c9cda01]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7f3913e6e1b7 - <rustc_middle[6a835cc3e0a555e0]::hir::map::Map>::for_each_module::<rustc_hir_analysis[ac41804801612bf5]::check_crate::{closure#6}::{closure#0}>
  40:     0x7f3913e6d5ed - <rustc_session[ab778da52d62d91c]::session::Session>::time::<(), rustc_hir_analysis[ac41804801612bf5]::check_crate::{closure#6}>
  41:     0x7f3913e6c277 - rustc_hir_analysis[ac41804801612bf5]::check_crate
  42:     0x7f3913e632ea - rustc_interface[99b7bac6f3a68274]::passes::analysis
  43:     0x7f3913efd80a - rustc_query_impl[a5debbf18c9cda01]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a5debbf18c9cda01]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 1usize]>>
  44:     0x7f3913efd7f9 - <rustc_query_impl[a5debbf18c9cda01]::query_impl::analysis::dynamic_query::{closure#2} as core[bcc6c1a0d905112a]::ops::function::FnOnce<(rustc_middle[6a835cc3e0a555e0]::ty::context::TyCtxt, ())>>::call_once
  45:     0x7f391407ba98 - rustc_query_system[9a6651a6b626ed91]::query::plumbing::try_execute_query::<rustc_query_impl[a5debbf18c9cda01]::DynamicConfig<rustc_query_system[9a6651a6b626ed91]::query::caches::SingleCache<rustc_middle[6a835cc3e0a555e0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a5debbf18c9cda01]::plumbing::QueryCtxt, false>
  46:     0x7f391407b869 - rustc_query_impl[a5debbf18c9cda01]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7f3913c38a05 - <rustc_middle[6a835cc3e0a555e0]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[5fd2fff4e2ab1b68]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>>
  48:     0x7f3913c38032 - <rustc_interface[99b7bac6f3a68274]::interface::Compiler>::enter::<rustc_driver_impl[5fd2fff4e2ab1b68]::run_compiler::{closure#1}::{closure#2}, core[bcc6c1a0d905112a]::result::Result<core[bcc6c1a0d905112a]::option::Option<rustc_interface[99b7bac6f3a68274]::queries::Linker>, rustc_span[330d20617ff3531a]::ErrorGuaranteed>>
  49:     0x7f3913c2ed45 - rustc_span[330d20617ff3531a]::set_source_map::<core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>, rustc_interface[99b7bac6f3a68274]::interface::run_compiler<core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>, rustc_driver_impl[5fd2fff4e2ab1b68]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  50:     0x7f3913c2e7b6 - <scoped_tls[df29aac8beac7397]::ScopedKey<rustc_span[330d20617ff3531a]::SessionGlobals>>::set::<rustc_interface[99b7bac6f3a68274]::interface::run_compiler<core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>, rustc_driver_impl[5fd2fff4e2ab1b68]::run_compiler::{closure#1}>::{closure#0}, core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>>
  51:     0x7f3913c2dd7c - std[6f71ef261950bfb1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[99b7bac6f3a68274]::util::run_in_thread_pool_with_globals<rustc_interface[99b7bac6f3a68274]::interface::run_compiler<core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>, rustc_driver_impl[5fd2fff4e2ab1b68]::run_compiler::{closure#1}>::{closure#0}, core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>>
  52:     0x7f3913c2db45 - <<std[6f71ef261950bfb1]::thread::Builder>::spawn_unchecked_<rustc_interface[99b7bac6f3a68274]::util::run_in_thread_pool_with_globals<rustc_interface[99b7bac6f3a68274]::interface::run_compiler<core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>, rustc_driver_impl[5fd2fff4e2ab1b68]::run_compiler::{closure#1}>::{closure#0}, core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bcc6c1a0d905112a]::result::Result<(), rustc_span[330d20617ff3531a]::ErrorGuaranteed>>::{closure#1} as core[bcc6c1a0d905112a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  53:     0x7f3911741305 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hee94a9b600b92b27
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/alloc/src/boxed.rs:2010:9
  54:     0x7f3911741305 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb557fd709dd3520f
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/alloc/src/boxed.rs:2010:9
  55:     0x7f3911741305 - std::sys::unix::thread::Thread::new::thread_start::h726c141aa23b2e83
                               at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/sys/unix/thread.rs:108:17
  56:     0x7f3911608609 - start_thread
  57:     0x7f391152b133 - clone
  58:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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.72.0-nightly (85bf07972 2023-07-06) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_borrowck] borrow-checking `baz`
#1 [type_of] computing type of `baz::{opaque#0}`
#2 [check_mod_item_types] checking item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
Backtrace

thread 'rustc' panicked at 'assertion failed: self.scc_universes[scc] == ty::UniverseIndex::ROOT', compiler/rustc_borrowck/src/region_infer/mod.rs:811:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/core/src/panicking.rs:67:14
   2: core::panicking::panic
             at /rustc/85bf07972a1041b9e25393b803d0e006bec3eaaf/library/core/src/panicking.rs:117:5
   3: <rustc_borrowck::region_infer::RegionInferenceContext>::solve
   4: rustc_borrowck::nll::compute_regions
   5: rustc_borrowck::do_mir_borrowck
   6: rustc_borrowck::mir_borrowck
   7: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
   8: rustc_hir_analysis::collect::type_of::type_of
   9: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
  10: rustc_hir_analysis::check::check::check_mod_item_types
  11: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
  12: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#6}>
  13: rustc_hir_analysis::check_crate
  14: rustc_interface::passes::analysis
  15: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  16: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
  17: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  18: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: the compiler unexpectedly panicked. this is a bug.

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.72.0-nightly (85bf07972 2023-07-06) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_borrowck] borrow-checking `baz`
#1 [type_of] computing type of `baz::{opaque#0}`
#2 [check_mod_item_types] checking item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack

@ilyvion ilyvion 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 Jul 8, 2023
@ilyvion
Copy link
Author

ilyvion commented Jul 8, 2023

This may be #108399 (?)

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