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

Panic on incomplete code with yield #91860

Closed
In-line opened this issue Dec 13, 2021 · 2 comments
Closed

Panic on incomplete code with yield #91860

In-line opened this issue Dec 13, 2021 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@In-line
Copy link
Contributor

In-line commented Dec 13, 2021

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
@hkmatsumoto hkmatsumoto added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 13, 2021
@hkmatsumoto
Copy link
Member

hkmatsumoto commented Dec 13, 2021

Could you try running cargo +nightly check to see if the compiler panics as well?
IIRC in the latest nightly the compiler has this patch (#91488) included, which resolved a similar bug.

@In-line
Copy link
Contributor Author

In-line commented Dec 14, 2021

Indeed I can confirm, that ICE doesn't happen with nightly! Thanks.

@In-line In-line closed this as completed Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants