Skip to content

thread 'rustc' panicked at 'Box<Any>': associated type missing default #86483

Closed
@Luro02

Description

@Luro02

Code

#![feature(generic_associated_types)]
pub trait IceIce<T>
where
    for<'a> T: 'a,
{
    type Ice<'v>: IntoIterator<Item = &'v T>;
}

fn main() {}

playground

Meta

The ICE happens on nightly, beta and stable:

rustc --version --verbose:

rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0
rustc 1.55.0-nightly (150fad30e 2021-06-19)
binary: rustc
commit-hash: 150fad30ea25e812d481a784d02c95d3394b234b
commit-date: 2021-06-19
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
rustc 1.53.0-beta.12 (e7a67cc91 2021-06-12)
binary: rustc
commit-hash: e7a67cc91667fd2a66798691732fddbe23f909eb
commit-date: 2021-06-12
host: x86_64-unknown-linux-gnu
release: 1.53.0-beta.12
LLVM version: 12.0.1

Error output

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> src/main.rs:1:1
  |
1 | #![feature(generic_associated_types)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> src/main.rs:1:12
  |
1 | #![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

error[E0311]: the parameter type `T` may not live long enough
 --> src/main.rs:2:1
  |
2 |   pub trait IceIce<T>
  |   ^                - help: consider adding an explicit lifetime bound...: `T: 'a`
  |  _|
  | |
3 | | where
4 | |     for<'a> T: 'a,
5 | | {
6 | |     type Ice<'v>: IntoIterator<Item = &'v T>;
7 | | }
  | |_^ ...so that the type `T` will meet its required lifetime bounds

error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:296:17: associated type missing default
 --> src/main.rs:6:5
  |
6 |     type Ice<'v>: IntoIterator<Item = &'v T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> ice.rs:1:1
  |
1 | #![feature(generic_associated_types)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> ice.rs:1:12
  |
1 | #![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

error[E0311]: the parameter type `T` may not live long enough
 --> ice.rs:2:1
  |
2 |   pub trait IceIce<T>
  |   ^                - help: consider adding an explicit lifetime bound...: `T: 'a`
  |  _|
  | |
3 | | where
4 | |     for<'a> T: 'a,
5 | | {
6 | |     type Ice<'v>: IntoIterator<Item = &'v T>;
7 | | }
  | |_^ ...so that the type `T` will meet its required lifetime bounds

error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:278:17: associated type missing default
 --> ice.rs:6:5
  |
6 |     type Ice<'v>: IntoIterator<Item = &'v T>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panic.rs:59:5
stack backtrace:
   0:     0x7f6a856e8990 - std::backtrace_rs::backtrace::libunwind::trace::h63b7a90188ab5fb3
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f6a856e8990 - std::backtrace_rs::backtrace::trace_unsynchronized::h80aefbf9b851eca7
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6a856e8990 - std::sys_common::backtrace::_print_fmt::hbef05ae4237a4d72
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f6a856e8990 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h28abce2fdb9884c2
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f6a85756f1f - core::fmt::write::h3b84512577ca38a8
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/fmt/mod.rs:1092:17
   5:     0x7f6a856dcae2 - std::io::Write::write_fmt::h465f8feea02e2aa1
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/io/mod.rs:1572:15
   6:     0x7f6a856ec7d5 - std::sys_common::backtrace::_print::h525280ee0d29bdde
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f6a856ec7d5 - std::sys_common::backtrace::print::h1f0f5b9f3ef8fb78
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f6a856ec7d5 - std::panicking::default_hook::{{closure}}::ha5838f6faa4a5a8f
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:208:50
   9:     0x7f6a856ec283 - std::panicking::default_hook::hfb9fe98acb0dcb3b
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:225:9
  10:     0x7f6a85ebd5eb - rustc_driver::report_ice::hfd0c5c387cfb7249
  11:     0x7f6a856ecf40 - std::panicking::rust_panic_with_hook::hb89f5f19036e6af8
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:595:17
  12:     0x7f6a86291826 - std::panicking::begin_panic::{{closure}}::hcca02cda194c8e1c
  13:     0x7f6a86291776 - std::sys_common::backtrace::__rust_end_short_backtrace::h0c07bb9016bd09dc
  14:     0x7f6a8630320f - std::panicking::begin_panic::h7cbeb0e2d96b6723
  15:     0x7f6a86281efd - std::panic::panic_any::h7253d23a606f6274
  16:     0x7f6a86280235 - rustc_errors::HandlerInner::span_bug::h783b87c001029cbf
  17:     0x7f6a86280940 - rustc_errors::Handler::span_bug::h9ca6a040147a4d46
  18:     0x7f6a862e555c - rustc_middle::ty::context::tls::with_opt::h39c1db1c8f976501
  19:     0x7f6a862e5600 - rustc_middle::util::bug::opt_span_bug_fmt::h6c08e68548cd2c38
  20:     0x7f6a862e55cc - rustc_middle::util::bug::span_bug_fmt::h914c00f48ab16e8c
  21:     0x7f6a873dedcc - rustc_typeck::collect::type_of::type_of::h7ac0ba90828dfb23
  22:     0x7f6a8755ccff - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hd6610421a3aa3b92
  23:     0x7f6a8756258c - rustc_data_structures::stack::ensure_sufficient_stack::h053b57fc00909b7c
  24:     0x7f6a87516113 - rustc_query_system::query::plumbing::force_query_with_job::h63aefa0da7b7e088
  25:     0x7f6a8750ad1e - rustc_query_system::query::plumbing::get_query_impl::hdf538e36dd46218c
  26:     0x7f6a8754cf2a - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of::h9ef5becbd0143cf7
  27:     0x7f6a86f996ee - rustc_middle::ty::context::TyCtxt::return_type_impl_trait::h1e3ffc97762ce604
  28:     0x7f6a86eafcb9 - rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::construct_generic_bound_failure::h772151037ca89461
  29:     0x7f6a86eaf114 - rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_generic_bound_failure::hbed3bd357e4dcfa2
  30:     0x7f6a87a1b94d - rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_region_errors::h1a991378c1ddcf81
  31:     0x7f6a87a21d27 - rustc_infer::infer::InferCtxt::resolve_regions_and_report_errors::hf08d613642aaeb4e
  32:     0x7f6a8734ee72 - rustc_typeck::check::regionck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::regionck_item::h5b3ea488257eaacb
  33:     0x7f6a873bb45f - rustc_infer::infer::InferCtxtBuilder::enter::he642a0bd6cc46746
  34:     0x7f6a8737886a - rustc_typeck::check::wfcheck::check_associated_item::h0366cf7287896055
  35:     0x7f6a87dc03a2 - rustc_typeck::check::wfcheck::check_trait_item::he2d4f60eb4e7ee76
  36:     0x7f6a8755b967 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hcab31c3a329af1ae
  37:     0x7f6a8751b480 - rustc_query_system::query::plumbing::force_query_with_job::h966485956f5fe2ad
  38:     0x7f6a8750d3a7 - rustc_query_system::query::plumbing::get_query_impl::hec8974d12695d517
  39:     0x7f6a87f8566d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_trait_item_well_formed::h4cbe1c14edb4408c
  40:     0x7f6a87dc3b39 - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_trait_item::h9a561165f4fda9aa
  41:     0x7f6a87dbbaf9 - rustc_data_structures::sync::par_for_each_in::h4acb0b8257fa5090
  42:     0x7f6a87dece1a - rustc_hir::hir::Crate::par_visit_all_item_likes::h3cee1a432e03978c
  43:     0x7f6a87ddb956 - rustc_session::session::Session::track_errors::h3646c81176cd45f5
  44:     0x7f6a87de7157 - rustc_typeck::check_crate::h0eb6801ba7deb9c9
  45:     0x7f6a87ba023d - rustc_interface::passes::analysis::hced9d204794eca4e
  46:     0x7f6a87f91357 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h59970cf0c94f9cd8
  47:     0x7f6a87fad6c7 - rustc_data_structures::stack::ensure_sufficient_stack::ha901701d858bba53
  48:     0x7f6a87f2f681 - rustc_query_system::query::plumbing::force_query_with_job::h28efd7908f94e5d1
  49:     0x7f6a87f06113 - rustc_query_system::query::plumbing::get_query_impl::h5c5b010893daac99
  50:     0x7f6a87f81edf - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::h35e91d1e9a4d7390
  51:     0x7f6a87b8e27b - rustc_interface::passes::QueryContext::enter::hed34c3214c24a16d
  52:     0x7f6a87b65072 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h25e70888d22e3a4c
  53:     0x7f6a87b5fa51 - rustc_span::with_source_map::h2cd9a6094ef7af0e
  54:     0x7f6a87b6604e - rustc_interface::interface::create_compiler_and_run::h5877f5f12804db55
  55:     0x7f6a87b608f8 - scoped_tls::ScopedKey<T>::set::hd60de2a62f3fb82b
  56:     0x7f6a87b663fb - std::sys_common::backtrace::__rust_begin_short_backtrace::hf09e28c4d01a4892
  57:     0x7f6a87b7da35 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hff3afb7d3b239db0
  58:     0x7f6a856fc72a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc444a77f8dd8d825
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/alloc/src/boxed.rs:1546:9
  59:     0x7f6a856fc72a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8b68a0a9a2093dfc
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/alloc/src/boxed.rs:1546:9
  60:     0x7f6a856fc72a - std::sys::unix::thread::Thread::new::thread_start::hb95464447f61f48d
                               at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys/unix/thread.rs:71:17
  61:     0x7f6a85630259 - start_thread
  62:     0x7f6a855455e3 - __GI___clone
  63:                0x0 - <unknown>

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.52.1 (9bc8c42bb 2021-05-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [type_of] computing type of `IceIce::Ice`
#1 [check_trait_item_well_formed] checking that `IceIce::Ice` is well-formed
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted

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

Metadata

Metadata

Assignees

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) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions