Skip to content

rustc 1.62-nightly got Internal Compiler Error when compiling "trait FromAll = for<T> From<T>" #96631

Closed
@chnlkw

Description

@chnlkw

Code

trait FromAll =  for<T> From<T>;  
trait FromAllWithSendAndSync =  for<T> From<T> where T : Send + Sync; 

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (4dd8b420c 2022-05-01)
binary: rustc
commit-hash: 4dd8b420c027001e47b0d811a7e55e2fe1de1395
commit-date: 2022-05-01
host: x86_64-pc-windows-msvc
release: 1.62.0-nightly
LLVM version: 14.0.1

Error output

error: only lifetime parameters can be used in this context
 --> tests\bug.rs:3:22
  |
3 | trait FromAll =  for<T> From<T>;
  |                      ^

error: only lifetime parameters can be used in this context
 --> tests\bug.rs:4:37
  |
4 | trait FromAllWithSendAndSync =  for<T> From<T> where T : Send + Sync;
  |                                     ^

error[E0412]: cannot find type `T` in this scope
 --> tests\bug.rs:4:54
  |
4 | trait FromAllWithSendAndSync =  for<T> From<T> where T : Send + Sync;
  |                                                      ^ not found in this scope

error[E0658]: trait aliases are experimental
 --> tests\bug.rs:3:1
  |
3 | trait FromAll =  for<T> From<T>;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
  = help: add `#![feature(trait_alias)]` to the crate attributes to enable

error[E0658]: trait aliases are experimental
 --> tests\bug.rs:4:1
  |
4 | trait FromAllWithSendAndSync =  for<T> From<T> where T : Send + Sync;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
  = help: add `#![feature(trait_alias)]` to the crate attributes to enable

thread 'rustc' panicked at 'no entry found for key', compiler\rustc_typeck\src\astconv\mod.rs:2265:29
stack backtrace:
   0:     0x7ff85164981f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8625ded047ed2522
   1:     0x7ff851679cca - core::fmt::write::h512246f701a9a3fa
   2:     0x7ff85163bf49 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hf6cd706445243974
   3:     0x7ff85164d00b - std::panicking::default_hook::h972e478088f50e7d
   4:     0x7ff85164cbfe - std::panicking::default_hook::h972e478088f50e7d
   5:     0x7fffec118176 - <rustc_middle[352cd0e1f647bdb4]::ty::SymbolName as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
   6:     0x7ff85164d8ea - std::panicking::rust_panic_with_hook::h5d3b547f90b7adae
   7:     0x7ff85164d63d - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h60bd2364d46420e9
   8:     0x7ff85164a317 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8625ded047ed2522
   9:     0x7ff85164d319 - rust_begin_unwind
  10:     0x7ff8516b7f35 - core::panicking::panic_fmt::he373f2294b0d11a6
  11:     0x7ff8516766b0 - <core::panic::panic_info::PanicInfo as core::fmt::Display>::fmt::h591acc9d4b2142b1
  12:     0x7ff85167665b - <core::panic::panic_info::PanicInfo as core::fmt::Display>::fmt::h591acc9d4b2142b1
  13:     0x7ff8516b7d89 - core::option::expect_failed::had66e6c96fced320
  14:     0x7fffeec39bb5 - <rustc_typeck[6295ca19728000f2]::check::regionck::RegionCtxt as rustc_hir[8b2b65a6f8700afc]::intravisit::Visitor>::visit_expr
  15:     0x7fffeec459fe - <<dyn rustc_typeck[6295ca19728000f2]::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck[6295ca19728000f2]::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind
  16:     0x7fffeec43ee2 - <<dyn rustc_typeck[6295ca19728000f2]::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck[6295ca19728000f2]::astconv::CreateSubstsForGenericArgsCtxt>::provided_kind
  17:     0x7fffeec43cc0 - <<dyn rustc_typeck[6295ca19728000f2]::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck[6295ca19728000f2]::astconv::CreateSubstsForGenericArgsCtxt>::provided_kind
  18:     0x7fffeec417e5 - <rustc_typeck[6295ca19728000f2]::astconv::ConvertedBindingKind as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
  19:     0x7fffeec204db - <rustc_typeck[6295ca19728000f2]::check::regionck::RegionCtxt as rustc_hir[8b2b65a6f8700afc]::intravisit::Visitor>::visit_expr
  20:     0x7fffeec44833 - <<dyn rustc_typeck[6295ca19728000f2]::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck[6295ca19728000f2]::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind
  21:     0x7fffeec44e2a - <<dyn rustc_typeck[6295ca19728000f2]::astconv::AstConv>::create_substs_for_ast_path::SubstsForAstPathCtxt as rustc_typeck[6295ca19728000f2]::astconv::CreateSubstsForGenericArgsCtxt>::inferred_kind
  22:     0x7fffeedbf497 - <rustc_typeck[6295ca19728000f2]::collect::ItemCtxt as rustc_typeck[6295ca19728000f2]::astconv::AstConv>::projected_ty_from_poly_trait_ref
  23:     0x7fffef8fbf62 - <rustc_query_impl[8fc8a331b5098fc]::queries::generator_diagnostic_data as rustc_query_system[953909a967a067fe]::query::config::QueryDescription<rustc_query_impl[8fc8a331b5098fc]::plumbing::QueryCtxt>>::describe
  24:     0x7fffefbaed6b - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  25:     0x7fffefb4c054 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  26:     0x7fffef842c77 - <rustc_query_impl[8fc8a331b5098fc]::Queries as rustc_middle[352cd0e1f647bdb4]::ty::query::QueryEngine>::try_mark_green
  27:     0x7fffeedbf195 - <rustc_typeck[6295ca19728000f2]::collect::ItemCtxt as rustc_typeck[6295ca19728000f2]::astconv::AstConv>::projected_ty_from_poly_trait_ref
  28:     0x7fffef8fad1b - <rustc_query_impl[8fc8a331b5098fc]::queries::generator_diagnostic_data as rustc_query_system[953909a967a067fe]::query::config::QueryDescription<rustc_query_impl[8fc8a331b5098fc]::plumbing::QueryCtxt>>::describe
  29:     0x7fffefb97933 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  30:     0x7fffefa5078d - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  31:     0x7fffefb27ab0 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  32:     0x7fffef842c26 - <rustc_query_impl[8fc8a331b5098fc]::Queries as rustc_middle[352cd0e1f647bdb4]::ty::query::QueryEngine>::try_mark_green
  33:     0x7fffeedb8f6c - <rustc_typeck[6295ca19728000f2]::collect::ItemCtxt as rustc_typeck[6295ca19728000f2]::astconv::AstConv>::projected_ty_from_poly_trait_ref
  34:     0x7fffeedb07d4 - <rustc_typeck[6295ca19728000f2]::collect::CollectItemTypesVisitor as rustc_hir[8b2b65a6f8700afc]::intravisit::Visitor>::visit_item
  35:     0x7fffeecbc9b7 - <rustc_typeck[6295ca19728000f2]::structured_errors::wrong_number_of_generic_args::GenericArgsInfo as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
  36:     0x7fffeedafdad - <rustc_typeck[6295ca19728000f2]::constrained_generic_params::Parameter as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
  37:     0x7fffef8fabb8 - <rustc_query_impl[8fc8a331b5098fc]::queries::generator_diagnostic_data as rustc_query_system[953909a967a067fe]::query::config::QueryDescription<rustc_query_impl[8fc8a331b5098fc]::plumbing::QueryCtxt>>::describe
  38:     0x7fffefb972d2 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  39:     0x7fffefa1eb75 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  40:     0x7fffefb34675 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  41:     0x7fffeecbbb91 - <rustc_typeck[6295ca19728000f2]::structured_errors::wrong_number_of_generic_args::GenericArgsInfo as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
  42:     0x7fffeec09de0 - <rustc_typeck[6295ca19728000f2]::collect::type_of::find_opaque_ty_constraints::ConstraintLocator as rustc_hir[8b2b65a6f8700afc]::intravisit::Visitor>::visit_trait_item
  43:     0x7fffeebd1bd5 - rustc_typeck[6295ca19728000f2]::check_crate
  44:     0x7fffec276e8f - rustc_interface[b5d4a0678fc71c3e]::passes::analysis
  45:     0x7fffef8fc47e - <rustc_query_impl[8fc8a331b5098fc]::queries::generator_diagnostic_data as rustc_query_system[953909a967a067fe]::query::config::QueryDescription<rustc_query_impl[8fc8a331b5098fc]::plumbing::QueryCtxt>>::describe
  46:     0x7fffefbb30af - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  47:     0x7fffefa9aa54 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  48:     0x7fffefb53016 - <(rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>, rustc_middle[352cd0e1f647bdb4]::ty::consts::kind::Unevaluated<()>) as rustc_query_impl[8fc8a331b5098fc]::keys::Key>::default_span
  49:     0x7fffec0d923f - <rustc_driver[b40df27f6a91b84b]::args::Error as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
  50:     0x7fffec0ac538 - <rustc_borrowck[2f9b6e4e3e933467]::type_check::relate_tys::NllTypeRelatingDelegate as rustc_infer[53af0d19a363ec26]::infer::nll_relate::TypeRelatingDelegate>::const_equate
  51:     0x7fffec12b025 - rustc_driver[b40df27f6a91b84b]::pretty::print_after_hir_lowering
  52:     0x7fffec0ad876 - <rustc_borrowck[2f9b6e4e3e933467]::type_check::relate_tys::NllTypeRelatingDelegate as rustc_infer[53af0d19a363ec26]::infer::nll_relate::TypeRelatingDelegate>::const_equate
  53:     0x7fffec0db916 - <rustc_driver[b40df27f6a91b84b]::args::Error as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
  54:     0x7fffec0dc948 - <rustc_driver[b40df27f6a91b84b]::args::Error as core[cb8fe68b4eeecabf]::fmt::Debug>::fmt
  55:     0x7ff85165ed5c - std::sys::windows::thread::Thread::new::h1230e6e43c8b9a1b
  56:     0x7ff894a854e0 - BaseThreadInitThunk
  57:     0x7ff895d0485b - RtlUserThreadStart

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.62.0-nightly (4dd8b420c 2022-05-01) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [super_predicates_that_define_assoc_type] computing the super traits of `FromAll`
#1 [super_predicates_of] computing the super predicates of `FromAll`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
Some errors have detailed explanations: E0412, E0658.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `generic-session-types` due to 5 previous err
Backtrace

<backtrace>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions