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

error: internal compiler error: broken MIR in DefId ... #61910

Closed
rajivr opened this issue Jun 17, 2019 · 1 comment · Fixed by #61872
Closed

error: internal compiler error: broken MIR in DefId ... #61910

rajivr opened this issue Jun 17, 2019 · 1 comment · Fixed by #61872
Assignees
Labels
A-async-await Area: Async & Await 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.

Comments

@rajivr
Copy link

rajivr commented Jun 17, 2019

I tried this code:

#![feature(async_await)]
#![feature(impl_trait_in_bindings)]

async fn a() {}

async fn b() {}

async fn start() {
    // ICE
    let a_boxed_fut: Box<impl std::future::Future> = Box::new(a());

    // NO ICE
    // let a_boxed_fut = Box::new(a());

    b().await;
}

fn main() {
    println!("Hello, world!");
}

This happened:

error: internal compiler error: broken MIR in DefId(0:20 ~ async_ice[a52a]::start[0]::{{closure}}[0]) (Terminator { source_info: SourceInfo { span: src/main.rs:10:54: 10:67, scope: scope[0] }, kind: _2 = const std::boxed::Box::<impl std::future::Future>::new(move _3) -> [return: bb6, unwind: bb8] }): call dest mismatch (std::boxed::Box<impl std::future::Future> <- std::boxed::Box<impl std::future::Future>): NoSolution
  --> src/main.rs:8:18
   |
8  |   async fn start() {
   |  __________________^
9  | |     // ICE
10 | |     let a_boxed_fut: Box<impl std::future::Future> = Box::new(a());
11 | |
...  |
15 | |     b().await;
16 | | }
   | |_^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:357:17
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.37.0-nightly (5f3656ce9 2019-06-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile `async-ice`.

To learn more, run the command again with --verbose.

Meta

rustc --version --verbose:

rustc 1.37.0-nightly (5f3656ce9 2019-06-11)
binary: rustc
commit-hash: 5f3656ce9a2212fad872605b7a4ee103a155e9f3
commit-date: 2019-06-11
host: x86_64-unknown-linux-gnu
release: 1.37.0-nightly
LLVM version: 8.0

Backtrace:

stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:212
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:479
   8: std::panicking::begin_panic
   9: <rustc_errors::Handler as core::ops::drop::Drop>::drop
  10: core::ptr::real_drop_in_place
  11: core::ptr::real_drop_in_place
  12: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
  13: core::ptr::real_drop_in_place
  14: rustc_interface::interface::run_compiler_in_existing_thread_pool
  15: std::thread::local::LocalKey<T>::with
  16: scoped_tls::ScopedKey<T>::set
  17: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
end of query stack

This is my first encounter with a rustc bug. I asked for guidance on #wg-async-foundation discord, and I was requested to tag issue #61834 as it might be related. Also, thank you for Rust. :-)

@Centril Centril added A-async-await Area: Async & Await AsyncAwait-Polish Async-await issues that are part of the "polish" area AsyncAwait-Unclear 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. and removed AsyncAwait-Polish Async-await issues that are part of the "polish" area labels Jun 17, 2019
@cramertj
Copy link
Member

I'm imagining this is a dup of #61834 and would also be closed by #61872

bors added a commit that referenced this issue Jun 26, 2019
…sakis

Clean up MIR drop generation

* Don't assign twice to the destination of a `while` loop containing a `break` expression
* Use `as_temp` to evaluate statement expression
* Avoid consecutive `StorageLive`s for the condition of a `while` loop
* Unify `return`, `break` and `continue` handling, and move it to `scopes.rs`
* Make some of the `scopes.rs` internals private
* Don't use `Place`s that are always `Local`s in MIR drop generation

Closes #42371
Closes #61579
Closes #61731
Closes #61834
Closes #61910
Closes #62115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants