Closed
Description
Code
trait Base<'f> {
type Assoc;
fn do_something(&self);
}
trait ForAnyLifetime: for<'f> Base<'f> {}
impl<T> ForAnyLifetime for T where T: for<'f> Base<'f> {}
trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {}
fn foo(a: &dyn CanBeDynamic) {
a.do_something();
}
fn main() {}
Meta
rustc --version --verbose
:
rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-pc-windows-msvc
release: 1.56.0
LLVM version: 13.0.0
This is also present in beta and nightly versions, but it is not present on 1.55.0 stable.
Error output
error: internal compiler error: compiler\rustc_trait_selection\src\traits\mod.rs:755:9: Failed to find info for expected trait in vtable
thread 'rustc' panicked at 'Box<dyn Any>', compiler\rustc_errors\src\lib.rs:1147:9
stack backtrace:
(see the backtrace section for the full backtrace)
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.56.0 (09c42c458 2021-10-18) running on x86_64-pc-windows-msvc
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=C:\Program Files\LLVM\bin\lld-link.exe -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `foo`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `rust_ice`
Backtrace
0: 0x7ffc97f07a9e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h07cd892bde293768
1: 0x7ffc97f3268a - core::fmt::write::h29abf31093ab5935
2: 0x7ffc97efac88 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h40386600605061bb
3: 0x7ffc97f0b586 - std::panicking::take_hook::he03d4c8985881b36
4: 0x7ffc97f0b074 - std::panicking::take_hook::he03d4c8985881b36
5: 0x7ffc8b17a525 - <tracing_subscriber::fmt::format::json::WriteAdaptor as std::io::Write>::flush::hde67080ba3658306
6: 0x7ffc97f0be99 - std::panicking::rust_panic_with_hook::h806e5bba08cf7c42
7: 0x7ffc8f7814c0 - <rustc_errors::styled_buffer::StyledChar as core::fmt::Debug>::fmt::h0f7f115d95d6e009
8: 0x7ffc8f781449 - <rustc_errors::styled_buffer::StyledChar as core::fmt::Debug>::fmt::h0f7f115d95d6e009
9: 0x7ffc8fa53bd1 - rustc_query_system::query::job::report_cycle::h9a6203922a678bda
10: 0x7ffc8f7af1b0 - <rustc_errors::json::Diagnostic::from_errors_diagnostic::BufWriter as std::io::Write>::flush::h4514f0044ddd3ee4
11: 0x7ffc8f7b7265 - rustc_errors::HandlerInner::emit_diagnostic::he222b80642dd446e
12: 0x7ffc8f7b4d12 - rustc_errors::Handler::bug::h2c8c5efa855ae4be
13: 0x7ffc8f49e3a7 - rustc_middle::ty::structural_impls::<impl core::fmt::Debug for rustc_middle::ty::closure::UpvarBorrow>::fmt::hd678a25acca54787
14: 0x7ffc8f49c660 - rustc_middle::ty::consts::valtree::ValTree::zst::h8aa8eda0b4c752ce
15: 0x7ffc8f49c603 - rustc_middle::ty::consts::valtree::ValTree::zst::h8aa8eda0b4c752ce
16: 0x7ffc8f49e2d9 - rustc_middle::ty::structural_impls::<impl core::fmt::Debug for rustc_middle::ty::closure::UpvarBorrow>::fmt::hd678a25acca54787
17: 0x7ffc8fa4a2c7 - rustc_middle::util::bug::bug_fmt::hdc415a5169316300
18: 0x7ffc8f2ebd5e - rustc_trait_selection::traits::impossible_predicates::h6168446ca8ba4d2c
19: 0x7ffc8f2face6 - <rustc_trait_selection::traits::select::TraitObligationStack as core::fmt::Debug>::fmt::h42371074e4d717d0
20: 0x7ffc8f3013aa - rustc_trait_selection::traits::select::SelectionContext::select::hca123c58bc622ce1
21: 0x7ffc8f28d42e - <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::normalize_projection_type::h90c75a2320931b77
22: 0x7ffc8f28ba9e - rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations::hc42fb10a0d8c0dcc
23: 0x7ffc8f2d5458 - <rustc_trait_selection::traits::specialize::OverlapError as core::fmt::Debug>::fmt::hab9f03740d18f5e8
24: 0x7ffc8f289ffc - rustc_trait_selection::traits::fulfill::FulfillmentContext::new_ignoring_regions::h39d25fbf849faa7e
25: 0x7ffc8f28a9e4 - <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_with_constness_where_possible::h14ff21ddcf1865f6
26: 0x7ffc8d842fcb - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::structurally_resolved_type::h713d93049989fe32
27: 0x7ffc8d84234a - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::structurally_resolved_type::h713d93049989fe32
28: 0x7ffc8d827516 - rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_for_cast::h4bd4dec8c57ead7f
29: 0x7ffc8d8863b6 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::he4c4873ab2d8c9f3
30: 0x7ffc8d847408 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt::h466a803b691a6b63
31: 0x7ffc8d847ea1 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_no_value::he72514003acfb9d8
32: 0x7ffc8d8863b6 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::he4c4873ab2d8c9f3
33: 0x7ffc8d831357 - rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_for_cast::h4bd4dec8c57ead7f
34: 0x7ffc8da65f41 - rustc_typeck::check::check::check_wf_new::hdffafb8990846ac0
35: 0x7ffc8d9ae4cc - <<dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind::h930fec7b8dca6715
36: 0x7ffc8d8b1443 - rustc_typeck::check::provide::h6a0f4ba684d1e07c
37: 0x7ffc8e8fc306 - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::he71a7fa6f0493805
38: 0x7ffc8e89e643 - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::he71a7fa6f0493805
39: 0x7ffc8e9c6be9 - rustc_query_impl::on_disk_cache::__ty_decoder_impl::<impl rustc_serialize::serialize::Decoder for rustc_query_impl::on_disk_cache::CacheDecoder>::error::hbd644ab6b1f9b216
40: 0x7ffc8e6a434a - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::h6dcd24be3bf40fc6
41: 0x7ffc8e61110f - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::h6dcd24be3bf40fc6
42: 0x7ffc8e9519e1 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h43f6f7a6dd139d2e
43: 0x7ffc8d9190db - <rustc_typeck::check::PlaceOp as core::fmt::Debug>::fmt::h2be515651766726e
44: 0x7ffc8d8b7873 - <rustc_typeck::check::CheckItemTypesVisitor as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h7580caa56f13530b
45: 0x7ffc8e90261b - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::he71a7fa6f0493805
46: 0x7ffc8e8a9776 - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::he71a7fa6f0493805
47: 0x7ffc8e9cf92b - rustc_query_impl::on_disk_cache::__ty_decoder_impl::<impl rustc_serialize::serialize::Decoder for rustc_query_impl::on_disk_cache::CacheDecoder>::error::hbd644ab6b1f9b216
48: 0x7ffc8e6c2469 - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::h6dcd24be3bf40fc6
49: 0x7ffc8e57fc28 - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::h6dcd24be3bf40fc6
50: 0x7ffc8e95191f - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h43f6f7a6dd139d2e
51: 0x7ffc8d91bbd8 - <rustc_typeck::check::PlaceOp as core::fmt::Debug>::fmt::h2be515651766726e
52: 0x7ffc8d8eb212 - rustc_typeck::check_crate::h60ac79a04151c346
53: 0x7ffc8b2b8e42 - rustc_interface::passes::analysis::ha6bb758b7871ca78
54: 0x7ffc8e9004cb - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::he71a7fa6f0493805
55: 0x7ffc8e8b49ed - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::he71a7fa6f0493805
56: 0x7ffc8e9cf085 - rustc_query_impl::on_disk_cache::__ty_decoder_impl::<impl rustc_serialize::serialize::Decoder for rustc_query_impl::on_disk_cache::CacheDecoder>::error::hbd644ab6b1f9b216
57: 0x7ffc8e6aca6b - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::h6dcd24be3bf40fc6
58: 0x7ffc8e54803e - <fixedbitset::FixedBitSet as core::fmt::Debug>::fmt::h6dcd24be3bf40fc6
59: 0x7ffc8e94d02c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_mark_green::h43f6f7a6dd139d2e
60: 0x7ffc8b1d0a1b - <rustc_ast::ast::Item as rustc_ast::ast_like::AstLike>::attrs::h46107129069754a8
61: 0x7ffc8b199215 - rustc_driver::pretty::print_after_hir_lowering::hf8699be6512bcdbc
62: 0x7ffc8b1d22b7 - <rustc_ast::ast::Item as rustc_ast::ast_like::AstLike>::attrs::h46107129069754a8
63: 0x7ffc8b19dd90 - <tracing_subscriber::util::TryInitError as core::fmt::Display>::fmt::h9a86ae0cce8205b9
64: 0x7ffc8b19a018 - rustc_driver::pretty::print_after_hir_lowering::hf8699be6512bcdbc
65: 0x7ffc8b18e8fd - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h80a36c605c7f9e5b
66: 0x7ffc97f1a1cc - std::sys::windows::thread::Thread::new::h1fb620a4b45ff0e1
67: 0x7ffcfb057034 - BaseThreadInitThunk
68: 0x7ffcfb542651 - RtlUserThreadStart