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

Broken MIR ICE with box yield #85635

Closed
PatchMixolydic opened this issue May 24, 2021 · 0 comments · Fixed by #89321
Closed

Broken MIR ICE with box yield #85635

PatchMixolydic opened this issue May 24, 2021 · 0 comments · Fixed by #89321
Labels
A-coroutines Area: Coroutines 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) ❄️ 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

@PatchMixolydic
Copy link
Contributor

PatchMixolydic commented May 24, 2021

May be related to #58504.

Code

#![feature(generators)]
#![feature(box_syntax)]

fn main() {
    || box yield;
}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (79e50bf77 2021-05-10)
binary: rustc
commit-hash: 79e50bf77928f374921a6bcafee3fcff1915f062
commit-date: 2021-05-10
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Also reproduced on the Playground using 1.54.0-nightly (2021-05-23 f64503eb555475d65ae5).

Error output

warning: unused generator that must be used
 --> src/main.rs:5:5
  |
5 |     || box yield;
  |     ^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_must_use)]` on by default
  = note: generators are lazy and do nothing unless resumed

warning: 1 warning emitted

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ playground[d309]::main::{closure#0}), const_param_did: None }) (end of phase Optimization) at bb2[0]:
encountered `Assign(((((*(_1.0: &mut [generator@src/main.rs:5:5: 5:17 {()}])) as variant#3).0: std::boxed::Box<()>), move _2))` with incompatible types:
left-hand side has type: Box<()>
right-hand side has type: ()
 --> src/main.rs:5:5
  |
5 |     || box yield;
  |     ^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/transform/validate.rs:120:36

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1021:13
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.54.0-nightly (f64503eb5 2021-05-23) 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:
end of query stack
Backtrace

warning: unused generator that must be used
 --> src/main.rs:5:5
  |
5 |     || box yield;
  |     ^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_must_use)]` on by default
  = note: generators are lazy and do nothing unless resumed

warning: 1 warning emitted

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:4 ~ playground[d309]::main::{closure#0}), const_param_did: None }) (end of phase Optimization) at bb2[0]:
encountered `Assign(((((*(_1.0: &mut [generator@src/main.rs:5:5: 5:17 {()}])) as variant#3).0: std::boxed::Box<()>), move _2))` with incompatible types:
left-hand side has type: Box<()>
right-hand side has type: ()
 --> src/main.rs:5:5
  |
5 |     || box yield;
  |     ^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/transform/validate.rs:120:36

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1021:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f64503eb555475d65ae5503ef22439ca5dd394fd/library/std/src/panicking.rs:515:5
   1: std::panicking::begin_panic_fmt
             at /rustc/f64503eb555475d65ae5503ef22439ca5dd394fd/library/std/src/panicking.rs:457:5
   2: rustc_errors::HandlerInner::flush_delayed
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place<rustc_session::parse::ParseSess>
   5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
   6: core::ptr::drop_in_place<rustc_interface::interface::Compiler>
   7: rustc_span::with_source_map
   8: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.54.0-nightly (f64503eb5 2021-05-23) 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:
end of query stack

@rustbot modify labels +A-generators

@PatchMixolydic PatchMixolydic 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 May 24, 2021
@rustbot rustbot added the A-coroutines Area: Coroutines label May 24, 2021
@RalfJung RalfJung added the requires-nightly This issue requires a nightly compiler in some way. label May 30, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Jun 4, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 5, 2021
@bors bors closed this as completed in 2726955 Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coroutines Area: Coroutines 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) ❄️ 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

Successfully merging a pull request may close this issue.

4 participants