Skip to content

ICE: with -Zchalk and GATs #80230

Description

@matthiaskrgr

Code

#![crate_type = "lib"]

#![feature(generic_associated_types)]
trait Foo {
  type PublicKey<'a> : From<&'a [u8]>;
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (29e32120c 2020-12-20)
binary: rustc
commit-hash: 29e32120c33d30ff526fc7f4d94ec9fce0dc10c9
commit-date: 2020-12-20
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

rustc -Zchalk ./62521-2.rs

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

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /cargo/registry/src/github.com-1ecc6299db9ec823/chalk-ir-0.36.0/src/lib.rs:1409:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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.50.0-nightly (1f5bc176b 2020-12-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z chalk

query stack during panic:
#0 [evaluate_goal] evaluating trait selection obligation `environment: [TraitPredicate(<Self as Foo>)], goal: <Self as Foo>::PublicKey<'_>: std::convert::From<&[u8]>`
#1 [check_trait_item_well_formed] checking that `Foo::PublicKey` is well-formed
end of query stack
warning: 1 warning emitted


Backtrace

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

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /cargo/registry/src/github.com-1ecc6299db9ec823/chalk-ir-0.36.0/src/lib.rs:1409:47
stack backtrace:
   0:     0x7f4fa6d676c7 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f4fa6d676c7 - std::backtrace_rs::backtrace::trace_unsynchronized::h84373278bfb39e0c
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f4fa6d676c7 - std::sys_common::backtrace::_print_fmt::h517324efde750597
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f4fa6d676c7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf594ab77fac89284
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f4fa6dd828c - core::fmt::write::h3868db8542c90941
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f4fa6d59592 - std::io::Write::write_fmt::h3f6656f045fa877f
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/io/mod.rs:1519:15
   6:     0x7f4fa6d6b3b5 - std::sys_common::backtrace::_print::hda7655c057c24dcc
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f4fa6d6b3b5 - std::sys_common::backtrace::print::h546a6c8431d46287
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f4fa6d6b3b5 - std::panicking::default_hook::{{closure}}::h006dd083853faf51
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:208:50
   9:     0x7f4fa6d6af0a - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:225:9
  10:     0x7f4fa760bea8 - rustc_driver::report_ice::h956234bae73e460f
  11:     0x7f4fa6d6bcb6 - std::panicking::rust_panic_with_hook::hb7a19826c029b1d6
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:595:17
  12:     0x7f4fa6d6b7a7 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:495:13
  13:     0x7f4fa6d67b8c - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f4fa6d6b739 - rust_begin_unwind
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:493:5
  15:     0x7f4fa6dd46a1 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/core/src/panicking.rs:92:14
  16:     0x7f4fa6dd45ed - core::panicking::panic::h35b77276aa4b0c12
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/core/src/panicking.rs:50:5
  17:     0x7f4fa7d277ed - chalk_solve::clauses::program_clauses_for_goal::h615fb6542c32cb7b
  18:     0x7f4fa7d664a0 - chalk_engine::logic::<impl chalk_engine::forest::Forest<I>>::get_or_create_table_for_ucanonical_goal::h05999f9311e9d45e
  19:     0x7f4fa7d65b2f - chalk_engine::logic::<impl chalk_engine::forest::Forest<I>>::get_or_create_table_for_subgoal::h8e2d78e08efe86b8
  20:     0x7f4fa7d3ea77 - chalk_engine::logic::SolveState<I>::ensure_root_answer::hff151791e705e93d
  21:     0x7f4fa7d650e4 - chalk_engine::logic::<impl chalk_engine::forest::Forest<I>>::root_answer::h80a720555ce8796f
  22:     0x7f4fa7d5e3b0 - <chalk_engine::forest::ForestSolver<I> as chalk_engine::context::AnswerStream<I>>::next_answer::hd07061f74fea59d4
  23:     0x7f4fa7d087d1 - <chalk_engine::slg::SlgContextOps<I> as chalk_engine::slg::aggregate::AggregateOps<I>>::make_solution::hd330c485590054aa
  24:     0x7f4fa7e18516 - rustc_traits::chalk::evaluate_goal::h3515e9f316a1d24d
  25:     0x7f4fa9b3c08d - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::evaluate_goal>::compute::hffab509853e7ade9
  26:     0x7f4fa9b30119 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::he2591b096e0705ae
  27:     0x7f4fa9cdca06 - rustc_data_structures::stack::ensure_sufficient_stack::ha9d3a74bc64064d5
  28:     0x7f4fa9c2811b - rustc_query_system::query::plumbing::get_query_impl::h17d1ab4c0e23dbd7
  29:     0x7f4fa9b4611c - <rustc_trait_selection::traits::chalk_fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible::h63cd36b5725dbb7f
  30:     0x7f4fa9b45e38 - <rustc_trait_selection::traits::chalk_fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_all_or_error::h1fa7188f83bea328
  31:     0x7f4fa80dec24 - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error::h9a5b56ae1ece1571
  32:     0x7f4fa8348ee6 - rustc_infer::infer::InferCtxtBuilder::enter::h57af5a554956d841
  33:     0x7f4fa8202c5a - rustc_typeck::check::wfcheck::check_associated_item::h0f4b96fee78b58c6
  34:     0x7f4fa82026d7 - rustc_typeck::check::wfcheck::check_trait_item::hd86dfd78b895ca50
  35:     0x7f4fa81c664e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_trait_item_well_formed>::compute::h3f61ca47efd0eff6
  36:     0x7f4fa827e174 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h63e3522442ec2b80
  37:     0x7f4fa81d3856 - rustc_data_structures::stack::ensure_sufficient_stack::hd5cfc48f7d911612
  38:     0x7f4fa83be7ca - rustc_query_system::query::plumbing::get_query_impl::h1906369a6c5132fd
  39:     0x7f4fa84277ae - rustc_query_system::query::plumbing::ensure_query_impl::ha9cfaa98603c7636
  40:     0x7f4fa82f1411 - rustc_data_structures::sync::par_for_each_in::hbe827f423321f663
  41:     0x7f4fa831e7be - rustc_hir::hir::Crate::par_visit_all_item_likes::hc81da380dd083fa9
  42:     0x7f4fa8250488 - rustc_session::session::Session::track_errors::h90dff0ce01c5e84a
  43:     0x7f4fa82d9b2b - rustc_typeck::check_crate::h0ef907d13e9924da
  44:     0x7f4fa7887892 - rustc_interface::passes::analysis::h1277a6a22a164c98
  45:     0x7f4fa766719b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::he772285573dcf530
  46:     0x7f4fa764f58d - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::haf660f8b5fc0a8b6
  47:     0x7f4fa75e73d1 - rustc_query_system::query::plumbing::get_query_impl::h9637293c1f2da416
  48:     0x7f4fa766c30f - rustc_interface::passes::QueryContext::enter::h33139460b088ed05
  49:     0x7f4fa7679d95 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h58cc75bad344bc3b
  50:     0x7f4fa7635597 - rustc_span::with_source_map::hb087a1c2bc75d8e9
  51:     0x7f4fa767af8b - rustc_interface::interface::create_compiler_and_run::ha492945fb183c01e
  52:     0x7f4fa7649530 - scoped_tls::ScopedKey<T>::set::hf41307147817b997
  53:     0x7f4fa765a7c7 - std::sys_common::backtrace::__rust_begin_short_backtrace::h645f3b510f7fe2fd
  54:     0x7f4fa75cf7ea - core::ops::function::FnOnce::call_once{{vtable.shim}}::h19b1a0a715ec4eae
  55:     0x7f4fa6d7b7ba - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/alloc/src/boxed.rs:1328:9
  56:     0x7f4fa6d7b7ba - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/alloc/src/boxed.rs:1328:9
  57:     0x7f4fa6d7b7ba - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys/unix/thread.rs:71:17
  58:     0x7f4fa6c6c3e9 - start_thread
  59:     0x7f4fa6b89293 - __GI___clone
  60:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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.50.0-nightly (1f5bc176b 2020-12-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z chalk

query stack during panic:
#0 [evaluate_goal] evaluating trait selection obligation `environment: [TraitPredicate(<Self as Foo>)], goal: <Self as Foo>::PublicKey<'_>: std::convert::From<&[u8]>`
#1 [check_trait_item_well_formed] checking that `Foo::PublicKey` is well-formed
#2 [analysis] running analysis passes on this crate
end of query stack
warning: 1 warning emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)A-trait-systemArea: Trait systemC-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions