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

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

Closed
Luro02 opened this issue Jun 20, 2021 · 5 comments · Fixed by #86505
Closed

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

Luro02 opened this issue Jun 20, 2021 · 5 comments · Fixed by #86505
Assignees
Labels
A-GATs Area: Generic associated types (GATs) A-traits Area: Trait system C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Luro02
Copy link
Contributor

Luro02 commented Jun 20, 2021

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`.

@Luro02 Luro02 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 Jun 20, 2021
@Luro02
Copy link
Contributor Author

Luro02 commented Jun 20, 2021

Maybe related to #78823

@Luro02
Copy link
Contributor Author

Luro02 commented Jun 20, 2021

Bisection:

********************************************************************************
Regression in nightly-2021-02-14
********************************************************************************

fetching https://static.rust-lang.org/dist/2021-02-13/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2021-02-13: 40 B / 40 B [===========================================================================================================================] 100.00 % 218.71 KB/s converted 2021-02-13 to 3f5aee2d5241139d808f4fdece0026603489afd1
fetching https://static.rust-lang.org/dist/2021-02-14/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2021-02-14: 40 B / 40 B [===========================================================================================================================] 100.00 % 221.77 KB/s converted 2021-02-14 to 8e54a21139ae96a2aca3129100b057662e2799b9
looking for regression commit between 2021-02-13 and 2021-02-14
cloning rust repository
fetching (via local git) commits from 3f5aee2d5241139d808f4fdece0026603489afd1 to 8e54a21139ae96a2aca3129100b057662e2799b9
opening existing repository at "rust.git"
refreshing repository
looking up first commit
looking up second commit
checking that commits are by bors and thus have ci artifacts...
finding bors merge commits
found 7 bors merge commits in the specified range
  commit[0] 2021-02-12UTC: Auto merge of #81744 - rylev:overlapping-early-exit2, r=lcnr
  commit[1] 2021-02-13UTC: Auto merge of #82045 - Dylan-DPC:rollup-244l0sb, r=Dylan-DPC
  commit[2] 2021-02-13UTC: Auto merge of #82053 - JohnTitor:rollup-ymi9q0g, r=JohnTitor
  commit[3] 2021-02-13UTC: Auto merge of #81854 - the8472:specialize-clone-slice, r=Mark-Simulacrum
  commit[4] 2021-02-13UTC: Auto merge of #81666 - hyd-dev:miri-windows-test-fail, r=Mark-Simulacrum
  commit[5] 2021-02-13UTC: Auto merge of #81494 - cuviper:btree-node-init, r=Mark-Simulacrum
  commit[6] 2021-02-13UTC: Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-se
validated commits found, specifying toolchains

installing 3f5aee2d5241139d808f4fdece0026603489afd1
cargo for x86_64-unknown-linux-gnu: 5.97 MB / 5.97 MB [================================================================================================================] 100.00 % 7.18 MB/s testing...
RESULT: 3f5aee2d5241139d808f4fdece0026603489afd1, ===> No
uninstalling 3f5aee2d5241139d808f4fdece0026603489afd1

installing 8e54a21139ae96a2aca3129100b057662e2799b9
cargo for x86_64-unknown-linux-gnu: 5.96 MB / 5.96 MB [================================================================================================================] 100.00 % 7.38 MB/s testing...
RESULT: 8e54a21139ae96a2aca3129100b057662e2799b9, ===> Yes
uninstalling 8e54a21139ae96a2aca3129100b057662e2799b9

installing 3158857297417566824631a85c4cb3c0615ec6c2
cargo for x86_64-unknown-linux-gnu: 5.97 MB / 5.97 MB [================================================================================================================] 100.00 % 7.27 MB/s testing...
RESULT: 3158857297417566824631a85c4cb3c0615ec6c2, ===> Yes
uninstalling 3158857297417566824631a85c4cb3c0615ec6c2

installing 21cbbdc44de84e3ea99bca239091e5d1c49af654
cargo for x86_64-unknown-linux-gnu: 5.97 MB / 5.97 MB [================================================================================================================] 100.00 % 7.12 MB/s testing...
RESULT: 21cbbdc44de84e3ea99bca239091e5d1c49af654, ===> No
uninstalling 21cbbdc44de84e3ea99bca239091e5d1c49af654

installing dd4851d503f3fae0c0c742a19e0d8e6e2140bd2a
cargo for x86_64-unknown-linux-gnu: 5.97 MB / 5.97 MB [================================================================================================================] 100.00 % 7.58 MB/s testing...
RESULT: dd4851d503f3fae0c0c742a19e0d8e6e2140bd2a, ===> Yes
uninstalling dd4851d503f3fae0c0c742a19e0d8e6e2140bd2a

searched toolchains 3f5aee2d5241139d808f4fdece0026603489afd1 through 8e54a21139ae96a2aca3129100b057662e2799b9


********************************************************************************
Regression in dd4851d503f3fae0c0c742a19e0d8e6e2140bd2a
********************************************************************************

==================================================================================
= Please file this regression report on the rust-lang/rust GitHub repository     =
=        New issue: https://github.com/rust-lang/rust/issues/new                 =
=     Known issues: https://github.com/rust-lang/rust/issues                     =
= Copy and paste the text below into the issue report thread.  Thanks!           =
==================================================================================

searched nightlies: from nightly-2021-02-06 to nightly-2021-06-20
regressed nightly: nightly-2021-02-14
searched commits: from https://github.com/rust-lang/rust/commit/3f5aee2d5241139d808f4fdece0026603489afd1 to https://github.com/rust-lang/rust/commit/8e54a21139ae96a2aca3129100b057662e2799b9
regressed commit: https://github.com/rust-lang/rust/commit/dd4851d503f3fae0c0c742a19e0d8e6e2140bd2a

<details>
<summary>bisected with <a href='https://github.com/rust-lang/cargo-bisect-rustc'>cargo-bisect-rustc</a> v0.6.0</summary>


Host triple: x86_64-unknown-linux-gnu
Reproduce with:
```bash
cargo bisect-rustc --regress ice --test-dir=foo

@jonas-schievink jonas-schievink added F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 20, 2021
@jackh726
Copy link
Member

Looks like #81995

@steffahn
Copy link
Member

ICE happens on stable and also even without the #[feature(generic_associated_type)] line so no requires-nightly.

@rustbot label regression-from-stable-to-stable, A-traits

@rustbot rustbot added A-traits Area: Trait system regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Jun 20, 2021
@JohnTitor JohnTitor self-assigned this Jun 21, 2021
@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-low

@apiraino apiraino added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 23, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this issue Jun 24, 2021
@bors bors closed this as completed in 117799b Jun 25, 2021
@fmease fmease added the A-GATs Area: Generic associated types (GATs) label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) A-traits Area: Trait system C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

8 participants