Skip to content

Panic on incomplete code with yield #91860

Closed
@In-line

Description

@In-line

This is the project test-rust.zip
Run cargo check.

MacOS Monterey 12.0.1

❯ rustc --version             
rustc 1.57.0 (f1edd0429 2021-11-29)

~/projects 
❯ cargo --version            
cargo 1.57.0 (b2e52d7ca 2021-10-21)

Output

error[E0658]: yield syntax is experimental
  --> src/main.rs:16:9
   |
16 |         yield 
   |         ^^^^^
   |
   = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information

error[E0728]: `await` is only allowed inside `async` functions and blocks
  --> src/main.rs:15:28
   |
7  | fn if_kernel<T: Clone + 'static>(
   |    --------- this is not `async`
...
15 |     while let Some(cond) = cond.next().await {
   |                            ^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks

warning: unused import: `pin_utils::pin_mut`
 --> src/main.rs:3:5
  |
3 | use pin_utils::pin_mut;
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `std::sync::Arc`
 --> src/main.rs:4:5
  |
4 | use std::sync::Arc;
  |     ^^^^^^^^^^^^^^

warning: unused import: `std::sync::Mutex`
 --> src/main.rs:5:5
  |
5 | use std::sync::Mutex;
  |     ^^^^^^^^^^^^^^^^

error[E0627]: yield expression outside of generator literal
  --> src/main.rs:16:9
   |
16 |         yield 
   |         ^^^^^

error[E0277]: the trait bound `(): futures::Stream` is not satisfied
  --> src/main.rs:11:6
   |
11 | ) -> impl Stream<Item = T>
   |      ^^^^^^^^^^^^^^^^^^^^^ the trait `futures::Stream` is not implemented for `()`

thread 'rustc' panicked at 'assertion failed: body.yield_ty().is_some() == universal_regions.yield_ty.is_some()', compiler/rustc_borrowck/src/type_check/input_output.rs:111: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.57.0 (f1edd0429 2021-11-29) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `if_kernel`
#1 [type_of] computing type of `if_kernel::{opaque#0}`
end of query stack
Some errors have detailed explanations: E0277, E0627, E0658, E0728.
For more information about an error, try `rustc --explain E0277`.
warning: `test-rust` (bin "test-rust") generated 3 warnings
error: could not compile `test-rust` due to 4 previous errors; 3 warnings emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions