Skip to content

ICE:assertion failed: body.yield_ty.is_some() && universal_regions.yield_ty.is_some() || body.yield_ty.is_none() && universal_regions.yield_ty.is_none() #78336

Closed
@chengniansun

Description

@chengniansun

Code

fn finds_explicit_bound<'b>() -> impl 'b {
    yield
}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (7bade6ef7 2020-10-23)
binary: rustc
commit-hash: 7bade6ef730cff83f3591479a98916920f66decd
commit-date: 2020-10-23
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: at least one trait must be specified
 --> reduced_mutant.rs:1:34
  |
1 | fn finds_explicit_bound<'b>() -> impl 'b {
  |                                  ^^^^^^^

error[E0658]: yield syntax is experimental
 --> reduced_mutant.rs:2:5
  |
2 |     yield
  |     ^^^^^
  |
  = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
  = help: add `#![feature(generators)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `reduced_mutant`
 --> reduced_mutant.rs:1:1
  |
1 | / fn finds_explicit_bound<'b>() -> impl 'b {
2 | |     yield
3 | | }
  | |_^ consider adding a `main` function to `reduced_mutant.rs`

error[E0627]: yield expression outside of generator literal
 --> reduced_mutant.rs:2:5
  |
2 |     yield
  |     ^^^^^

thread 'rustc' panicked at 'assertion failed: body.yield_ty.is_some() && universal_regions.yield_ty.is_some() ||
    body.yield_ty.is_none() && universal_regions.yield_ty.is_none()', compiler/rustc_mir/src/borrow_check/type_check/input_output.rs:110:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.49.0-nightly (7bade6ef7 2020-10-23) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `finds_explicit_bound`
#1 [type_of] computing type of `finds_explicit_bound::{opaque#0}`
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0601, E0627, E0658.
For more information about an error, try `rustc --explain E0601`.
Backtrace

thread 'rustc' panicked at 'assertion failed: body.yield_ty.is_some() && universal_regions.yield_ty.is_some() ||
    body.yield_ty.is_none() && universal_regions.yield_ty.is_none()', compiler/rustc_mir/src/borrow_check/type_check/input_output.rs:110:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_mir::borrow_check::type_check::type_check
   2: rustc_mir::borrow_check::nll::compute_regions
   3: rustc_mir::borrow_check::do_mir_borrowck
   4: rustc_infer::infer::InferCtxtBuilder::enter
   5: rustc_mir::borrow_check::mir_borrowck
   6: core::ops::function::FnOnce::call_once
   7: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute
   8: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
   9: rustc_data_structures::stack::ensure_sufficient_stack
  10: rustc_query_system::query::plumbing::get_query_impl
  11: rustc_typeck::collect::type_of::type_of
  12: 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
  13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  14: rustc_data_structures::stack::ensure_sufficient_stack
  15: rustc_query_system::query::plumbing::get_query_impl
  16: rustc_typeck::check::check::check_item_type
  17: rustc_middle::hir::map::Map::visit_item_likes_in_module
  18: rustc_typeck::check::check::check_mod_item_types
  19: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_item_types>::compute
  20: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  21: rustc_data_structures::stack::ensure_sufficient_stack
  22: rustc_query_system::query::plumbing::get_query_impl
  23: rustc_query_system::query::plumbing::ensure_query_impl
  24: rustc_session::utils::<impl rustc_session::session::Session>::time
  25: rustc_typeck::check_crate
  26: rustc_interface::passes::analysis
  27: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  29: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
  30: rustc_query_system::query::plumbing::get_query_impl
  31: rustc_interface::passes::QueryContext::enter
  32: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  33: rustc_span::with_source_map
  34: rustc_interface::interface::create_compiler_and_run
  35: scoped_tls::ScopedKey<T>::set

NOTE: The bug is found by our work-in-progress compiler testing tool Kira, and the test program is reduced/minimized by Perses

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerA-coroutinesArea: CoroutinesA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.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