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: assertion failed: !self.intercrate #113415

Closed
matthiaskrgr opened this issue Jul 6, 2023 · 3 comments · Fixed by #113742
Closed

ICE: assertion failed: !self.intercrate #113415

matthiaskrgr opened this issue Jul 6, 2023 · 3 comments · Fixed by #113742
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-specialization `#![feature(specialization)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(specialization)]

trait Assoc {
    type Output;
}

default impl<T> Assoc for T {
    type Output = bool;
}

impl Assoc for u8 {}

trait Foo {}
impl Foo for u32 {}
impl Foo for <u8 as Assoc>::Output {}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (d9c13cd45 2023-07-05)
binary: rustc
commit-hash: d9c13cd4531649c2028a8384cb4d4e54f985380e
commit-date: 2023-07-05
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output


Backtrace

warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> treereduce.out:1:12
  |
1 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
  = help: consider using `min_specialization` instead, which is more stable and complete
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `treereduce`
  --> treereduce.out:15:38
   |
15 | impl Foo for <u8 as Assoc>::Output {}
   |                                      ^ consider adding a `main` function to `treereduce.out`

thread 'rustc' panicked at 'assertion failed: !self.intercrate', compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:100:13
stack backtrace:
   0:     0x7f1a5fb63a81 - std::backtrace_rs::backtrace::libunwind::trace::h3c8b1207af9f7dc4
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1a5fb63a81 - std::backtrace_rs::backtrace::trace_unsynchronized::h6cc4d1ef12765b77
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1a5fb63a81 - std::sys_common::backtrace::_print_fmt::h4b58ac6692087093
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f1a5fb63a81 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4cfe701aadad59ba
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1a5fbc9d8f - core::fmt::rt::Argument::fmt::h017682705ed0d628
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/core/src/fmt/rt.rs:138:9
   5:     0x7f1a5fbc9d8f - core::fmt::write::h69b96bfc1fe292d1
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f1a5fb563c7 - std::io::Write::write_fmt::h320e7f56f42ea27f
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/io/mod.rs:1714:15
   7:     0x7f1a5fb63895 - std::sys_common::backtrace::_print::h0061961dcfb0fc1f
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1a5fb63895 - std::sys_common::backtrace::print::h3caf3df7088e0a43
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1a5fb66673 - std::panicking::default_hook::{{closure}}::h77ae45a48b0419f4
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:269:22
  10:     0x7f1a5fb66404 - std::panicking::default_hook::h1750cbe688cc23cf
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:288:9
  11:     0x7f1a62e72cab - rustc_driver_impl[c8224e60c583ce9e]::install_ice_hook::{closure#0}
  12:     0x7f1a5fb66e9e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2f7c4b5be15d65f3
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/alloc/src/boxed.rs:2024:9
  13:     0x7f1a5fb66e9e - std::panicking::rust_panic_with_hook::hb1e7052d584ca5b8
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:709:13
  14:     0x7f1a5fb66be1 - std::panicking::begin_panic_handler::{{closure}}::haa7ba27cd61f2c57
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:595:13
  15:     0x7f1a5fb63ee6 - std::sys_common::backtrace::__rust_end_short_backtrace::hf9f1a9ff381b40f6
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f1a5fb66972 - rust_begin_unwind
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/panicking.rs:593:5
  17:     0x7f1a5fbc5fe3 - core::panicking::panic_fmt::h7ce7a976d3070fa0
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/core/src/panicking.rs:67:14
  18:     0x7f1a5fbc6073 - core::panicking::panic::hc2792b9695c02495
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/core/src/panicking.rs:117:5
  19:     0x7f1a610b71fa - <rustc_trait_selection[41dd4520de8bf710]::traits::fulfill::FulfillProcessor as rustc_data_structures[c8b73cf51072de45]::obligation_forest::ObligationProcessor>::process_obligation
  20:     0x7f1a610a8bf4 - <rustc_data_structures[c8b73cf51072de45]::obligation_forest::ObligationForest<rustc_trait_selection[41dd4520de8bf710]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[41dd4520de8bf710]::traits::fulfill::FulfillProcessor>
  21:     0x7f1a61266dff - <rustc_trait_selection[41dd4520de8bf710]::traits::engine::ObligationCtxt>::select_all_or_error
  22:     0x7f1a6123c7f7 - rustc_trait_selection[41dd4520de8bf710]::traits::specialize::translate_substs
  23:     0x7f1a6122845b - rustc_trait_selection[41dd4520de8bf710]::traits::project::opt_normalize_projection_type
  24:     0x7f1a6122346f - <rustc_trait_selection[41dd4520de8bf710]::traits::project::AssocTypeNormalizer as rustc_type_ir[6aab80a962adc91c]::fold::TypeFolder<rustc_middle[a92143083d338f81]::ty::context::TyCtxt>>::fold_ty
  25:     0x7f1a61b33715 - <rustc_middle[a92143083d338f81]::ty::ImplHeader as rustc_type_ir[6aab80a962adc91c]::fold::TypeFoldable<rustc_middle[a92143083d338f81]::ty::context::TyCtxt>>::fold_with::<rustc_trait_selection[41dd4520de8bf710]::traits::project::AssocTypeNormalizer>
  26:     0x7f1a61b32754 - <rustc_trait_selection[41dd4520de8bf710]::traits::project::AssocTypeNormalizer>::fold::<rustc_middle[a92143083d338f81]::ty::ImplHeader>
  27:     0x7f1a61b32099 - rustc_trait_selection[41dd4520de8bf710]::traits::project::normalize_with_depth::<rustc_middle[a92143083d338f81]::ty::ImplHeader>
  28:     0x7f1a61b31d99 - <rustc_infer[513a04dd9302731b]::infer::at::At as rustc_trait_selection[41dd4520de8bf710]::traits::project::NormalizeExt>::normalize::<rustc_middle[a92143083d338f81]::ty::ImplHeader>
  29:     0x7f1a61b31580 - rustc_trait_selection[41dd4520de8bf710]::traits::coherence::with_fresh_ty_vars
  30:     0x7f1a61b277e6 - rustc_trait_selection[41dd4520de8bf710]::traits::coherence::overlap
  31:     0x7f1a62028c6b - <rustc_middle[a92143083d338f81]::traits::specialization_graph::Children as rustc_trait_selection[41dd4520de8bf710]::traits::specialize::specialization_graph::ChildrenExt>::insert
  32:     0x7f1a62026ec0 - <rustc_middle[a92143083d338f81]::traits::specialization_graph::Graph as rustc_trait_selection[41dd4520de8bf710]::traits::specialize::specialization_graph::GraphExt>::insert
  33:     0x7f1a62025a83 - rustc_trait_selection[41dd4520de8bf710]::traits::specialize::specialization_graph_provider
  34:     0x7f1a6226317b - rustc_query_impl[7a314159d938cad9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7a314159d938cad9]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 8usize]>>
  35:     0x7f1a62263151 - <rustc_query_impl[7a314159d938cad9]::query_impl::specialization_graph_of::dynamic_query::{closure#2} as core[39f2cadfad9b7192]::ops::function::FnOnce<(rustc_middle[a92143083d338f81]::ty::context::TyCtxt, rustc_span[c131c644fb7cb5fa]::def_id::DefId)>>::call_once
  36:     0x7f1a60e88d55 - rustc_query_system[fcf123a786d6e0bc]::query::plumbing::try_execute_query::<rustc_query_impl[7a314159d938cad9]::DynamicConfig<rustc_query_system[fcf123a786d6e0bc]::query::caches::DefaultCache<rustc_span[c131c644fb7cb5fa]::def_id::DefId, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[7a314159d938cad9]::plumbing::QueryCtxt, false>
  37:     0x7f1a627f86a4 - rustc_query_impl[7a314159d938cad9]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f1a621c50b1 - rustc_hir_analysis[58a31f7655e3c3]::coherence::coherent_trait
  39:     0x7f1a61b0e3b1 - rustc_query_impl[7a314159d938cad9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7a314159d938cad9]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 0usize]>>
  40:     0x7f1a61b0e391 - <rustc_query_impl[7a314159d938cad9]::query_impl::coherent_trait::dynamic_query::{closure#2} as core[39f2cadfad9b7192]::ops::function::FnOnce<(rustc_middle[a92143083d338f81]::ty::context::TyCtxt, rustc_span[c131c644fb7cb5fa]::def_id::DefId)>>::call_once
  41:     0x7f1a6238a960 - rustc_query_system[fcf123a786d6e0bc]::query::plumbing::try_execute_query::<rustc_query_impl[7a314159d938cad9]::DynamicConfig<rustc_query_system[fcf123a786d6e0bc]::query::caches::DefaultCache<rustc_span[c131c644fb7cb5fa]::def_id::DefId, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[7a314159d938cad9]::plumbing::QueryCtxt, false>
  42:     0x7f1a6238a6ce - rustc_query_impl[7a314159d938cad9]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7f1a622b1433 - <rustc_session[ba0171e1a42d92f9]::session::Session>::track_errors::<rustc_hir_analysis[58a31f7655e3c3]::check_crate::{closure#3}, ()>
  44:     0x7f1a622aed0e - rustc_hir_analysis[58a31f7655e3c3]::check_crate
  45:     0x7f1a622a5dda - rustc_interface[6ebb3a637cfebd5]::passes::analysis
  46:     0x7f1a6233368a - rustc_query_impl[7a314159d938cad9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7a314159d938cad9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 1usize]>>
  47:     0x7f1a62333679 - <rustc_query_impl[7a314159d938cad9]::query_impl::analysis::dynamic_query::{closure#2} as core[39f2cadfad9b7192]::ops::function::FnOnce<(rustc_middle[a92143083d338f81]::ty::context::TyCtxt, ())>>::call_once
  48:     0x7f1a624ad878 - rustc_query_system[fcf123a786d6e0bc]::query::plumbing::try_execute_query::<rustc_query_impl[7a314159d938cad9]::DynamicConfig<rustc_query_system[fcf123a786d6e0bc]::query::caches::SingleCache<rustc_middle[a92143083d338f81]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[7a314159d938cad9]::plumbing::QueryCtxt, false>
  49:     0x7f1a624ad649 - rustc_query_impl[7a314159d938cad9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7f1a6205d455 - <rustc_middle[a92143083d338f81]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  51:     0x7f1a6205ca82 - <rustc_interface[6ebb3a637cfebd5]::interface::Compiler>::enter::<rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}::{closure#2}, core[39f2cadfad9b7192]::result::Result<core[39f2cadfad9b7192]::option::Option<rustc_interface[6ebb3a637cfebd5]::queries::Linker>, rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  52:     0x7f1a62053795 - rustc_span[c131c644fb7cb5fa]::set_source_map::<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  53:     0x7f1a62053206 - <scoped_tls[8bf4edb3452830f]::ScopedKey<rustc_span[c131c644fb7cb5fa]::SessionGlobals>>::set::<rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  54:     0x7f1a620527cc - std[fa0d0b5c306c9702]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6ebb3a637cfebd5]::util::run_in_thread_pool_with_globals<rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>
  55:     0x7f1a62052595 - <<std[fa0d0b5c306c9702]::thread::Builder>::spawn_unchecked_<rustc_interface[6ebb3a637cfebd5]::util::run_in_thread_pool_with_globals<rustc_interface[6ebb3a637cfebd5]::interface::run_compiler<core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>, rustc_driver_impl[c8224e60c583ce9e]::run_compiler::{closure#1}>::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[39f2cadfad9b7192]::result::Result<(), rustc_span[c131c644fb7cb5fa]::ErrorGuaranteed>>::{closure#1} as core[39f2cadfad9b7192]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7f1a5fb71315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h21ee91033946694b
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/alloc/src/boxed.rs:2010:9
  57:     0x7f1a5fb71315 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdf07228f28997b56
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/alloc/src/boxed.rs:2010:9
  58:     0x7f1a5fb71315 - std::sys::unix::thread::Thread::new::thread_start::h79fe093c0599c14c
                               at /rustc/d9c13cd4531649c2028a8384cb4d4e54f985380e/library/std/src/sys/unix/thread.rs:108:17
  59:     0x7f1a5f90244b - <unknown>
  60:     0x7f1a5f985e40 - <unknown>
  61:                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 (d9c13cd45 2023-07-05) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `Foo`
#1 [coherent_trait] coherence checking all impls of trait `Foo`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 1 warning emitted

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

@matthiaskrgr matthiaskrgr added 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. A-specialization Area: Trait impl specialization C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. F-specialization `#![feature(specialization)]` labels Jul 6, 2023
@compiler-errors
Copy link
Member

cc @lcnr, you added this assertion 😃

@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-07-06
Regression in 5dac6b3

@lcnr
Copy link
Contributor

lcnr commented Jul 13, 2023

so this was clearly buggy before and I expect it to be an issue limited to specialization. Going to not look into this further myself for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-specialization `#![feature(specialization)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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.

3 participants