Closed
Description
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. :-)