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: impl trait in bindings can't type-check body of DefId #78721

Closed
DutchGhost opened this issue Nov 4, 2020 · 1 comment
Closed

ICE: impl trait in bindings can't type-check body of DefId #78721

DutchGhost opened this issue Nov 4, 2020 · 1 comment
Labels
A-typesystem Area: The type system C-bug Category: This is a bug. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. 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

@DutchGhost
Copy link
Contributor

DutchGhost commented Nov 4, 2020

Code

#![feature(impl_trait_in_bindings)]

struct Bug {
    V1: [(); {
        let f: impl core::future::Future<Output = u8> = async { 1 };
        1
    }],
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (338f939a8 2020-11-02)

Error output

error: internal compiler error: compiler/rustc_typeck/src/check/mod.rs:489:9: can't type-check body of DefId(0:3 ~ playground[f69e]::Bug)
Backtrace

thread 'rustc' panicked at 'Box<Any>', /rustc/338f939a8d77061896cd0a1ca87a2c6d1f4ec359/compiler/rustc_errors/src/lib.rs:904:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::span_bug
   2: rustc_errors::Handler::span_bug
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt
   6: rustc_middle::util::bug::opt_span_bug_fmt
   7: rustc_middle::util::bug::span_bug_fmt
   8: rustc_typeck::check::typeck_with_fallback::{{closure}}
   9: rustc_typeck::check::typeck
  10: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
  11: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  12: rustc_data_structures::stack::ensure_sufficient_stack
  13: rustc_query_system::query::plumbing::get_query_impl
  14: rustc_typeck::collect::type_of::type_of
  15: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::type_of>::compute
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  17: rustc_data_structures::stack::ensure_sufficient_stack
  18: rustc_query_system::query::plumbing::get_query_impl
  19: <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
  20: <rustc_infer::infer::at::At as rustc_trait_selection::traits::query::normalize::AtExt>::normalize
  21: rustc_infer::infer::InferCtxtBuilder::enter
  22: rustc_traits::normalize_erasing_regions::normalize_generic_arg_after_erasing_regions
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::get_query_impl
  26: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty
  27: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::needs_drop
  28: rustc_mir::dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits
  29: <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_pass
  30: rustc_mir::transform::run_passes
  31: rustc_mir::transform::run_post_borrowck_cleanup_passes
  32: rustc_mir::transform::mir_drops_elaborated_and_const_checked
  33: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_drops_elaborated_and_const_checked>::compute
  34: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  35: rustc_data_structures::stack::ensure_sufficient_stack
  36: rustc_query_system::query::plumbing::get_query_impl
  37: rustc_mir::transform::optimized_mir
  38: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute
  39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  40: rustc_data_structures::stack::ensure_sufficient_stack
  41: rustc_query_system::query::plumbing::get_query_impl
  42: rustc_mir::interpret::eval_context::InterpCx<M>::load_mir
  43: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
  44: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute
  45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  46: rustc_data_structures::stack::ensure_sufficient_stack
  47: rustc_query_system::query::plumbing::get_query_impl
  48: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  49: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
  50: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  51: rustc_data_structures::stack::ensure_sufficient_stack
  52: rustc_query_system::query::plumbing::get_query_impl
  53: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  54: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
  55: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  56: rustc_data_structures::stack::ensure_sufficient_stack
  57: rustc_query_system::query::plumbing::get_query_impl
  58: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id
  59: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  60: rustc_middle::ty::consts::Const::eval
  61: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  62: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
  63: rustc_data_structures::stack::ensure_sufficient_stack
  64: rustc_trait_selection::traits::project::normalize
  65: <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::partially_normalize_associated_types_in
  66: rustc_typeck::check::inherited::Inherited::normalize_associated_types_in
  67: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  68: rustc_infer::infer::InferCtxtBuilder::enter
  69: rustc_typeck::check::wfcheck::check_item_well_formed
  70: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_item_well_formed>::compute
  71: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  72: rustc_data_structures::stack::ensure_sufficient_stack
  73: rustc_query_system::query::plumbing::get_query_impl
  74: rustc_query_system::query::plumbing::ensure_query_impl
  75: rustc_data_structures::sync::par_for_each_in
  76: rustc_hir::hir::Crate::par_visit_all_item_likes
  77: rustc_session::session::Session::track_errors
  78: rustc_typeck::check_crate
  79: rustc_interface::passes::analysis
  80: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  81: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  82: rustc_data_structures::stack::ensure_sufficient_stack
  83: rustc_query_system::query::plumbing::get_query_impl
  84: rustc_interface::passes::QueryContext::enter
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.49.0-nightly (338f939a8 2020-11-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin

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

query stack during panic:
#0 [typeck] type-checking `Bug`
#1 [type_of] computing type of `Bug::V1::{constant#0}::{opaque#0}`
#2 [normalize_generic_arg_after_erasing_regions] normalizing `impl std::future::Future`
#3 [mir_drops_elaborated_and_const_checked] elaborating drops for `Bug::V1::{constant#0}`
#4 [optimized_mir] optimizing MIR for `Bug::V1::{constant#0}`
#5 [eval_to_allocation_raw] const-evaluating + checking `Bug::V1::{constant#0}`
#6 [eval_to_const_value_raw] simplifying constant for the type system `Bug::V1::{constant#0}`
#7 [eval_to_const_value_raw] simplifying constant for the type system `Bug::V1::{constant#0}`
#8 [check_item_well_formed] checking that `Bug` is well-formed
#9 [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 E0493`.
error: could not compile `playground`

@DutchGhost DutchGhost 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 Nov 4, 2020
@jyn514 jyn514 added F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` requires-nightly This issue requires a nightly compiler in some way. A-typesystem Area: The type system labels Nov 4, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Nov 8, 2020
@Alexendoo
Copy link
Member

No longer ICEs since #78809

Alexendoo added a commit to Alexendoo/rust that referenced this issue Nov 16, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system C-bug Category: This is a bug. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. 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

No branches or pull requests

4 participants