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: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 opened this issue Oct 24, 2020 · 5 comments
Labels
A-borrow-checker Area: The borrow checker A-coroutines Area: Coroutines A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-inference Area: Type inference A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium 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

@chengniansun
Copy link

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

@chengniansun chengniansun 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 Oct 24, 2020
@jonas-schievink jonas-schievink added A-coroutines Area: Coroutines A-borrow-checker Area: The borrow checker A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 24, 2020
@camelid camelid added the A-lifetimes Area: Lifetimes / regions label Oct 24, 2020
@camelid
Copy link
Member

camelid commented Oct 24, 2020

searched toolchains nightly-2019-01-01 through nightly-2020-10-24

********************************************************************************
Regression in nightly-2020-02-16
********************************************************************************

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 24, 2020
@camelid camelid added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 24, 2020
@camelid
Copy link
Member

camelid commented Oct 24, 2020

Assigning P-medium and removing I-prioritize as discussed in the prioritization working group.

@JohnTitor JohnTitor added the A-inference Area: Type inference label Oct 25, 2020
@JohnTitor
Copy link
Member

I think it's related to #67681, cc @matthewjasper.

@matthiaskrgr
Copy link
Member

@rustbot modify labels: +regression-from-stable-to-stable

@rustbot rustbot added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Dec 20, 2020
@Alexendoo
Copy link
Member

Fixed by #91488

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker A-coroutines Area: Coroutines A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-inference Area: Type inference A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium 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

No branches or pull requests

8 participants