Closed
Description
I tried compiling this code:
#![feature(await_macro, async_await, futures_api)]
#[macro_use]
extern crate tokio;
fn main() {
tokio::run_async((async {}));
}
Note the extra set of parentheses.
My Cargo.toml had:
[package]
name = "rs_server"
version = "0.1.0"
authors = ["Joshua Netterfield <joshua@nettek.ca>"]
edition = "2018"
[dependencies]
futures = "0.1.24"
tokio = {version = "0.1.11", features = ["async-await-preview"]}
I expected the compiler to not crash.
Instead, it crashed with the following output:
env RUST_BACKTRACE=1 cargo +nightly build
... snip ...
Compiling rs_server v0.1.0 (/Users/joshua/dev/hacklily/server/rs-server)
Running `rustc --edition=2018 --crate-name rs_server src/main.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=570ddfa143c25928 -C extra-filename=-570ddfa143c25928 --out-dir /Users/joshua/dev/hacklily/server/rs-server/target/debug/deps -C incremental=/Users/joshua/dev/hacklily/server/rs-server/target/debug/incremental -L dependency=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps --extern futures=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps/libfutures-896873aebf27fd84.rlib --extern tokio=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps/libtokio-4702d2f4954beb28.rlib --extern tokio_process=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps/libtokio_process-5537fdad580af0a3.rlib`
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::continue_panic_fmt
7: rust_begin_unwind
8: core::panicking::panic_fmt
9: core::panicking::panic
10: syntax::print::pprust::State::print_expr_outer_attr_style
11: syntax::print::pprust::State::print_expr_outer_attr_style
12: syntax::print::pprust::to_string
13: syntax::print::pprust::expr_to_string
14: rustc_lint::unused::UnusedParens::check_unused_parens_core
15: <rustc_lint::unused::UnusedParens as rustc::lint::EarlyLintPass>::check_expr
16: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_expr
17: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_block
18: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_fn
19: syntax::visit::walk_item
20: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_item
21: <rustc::lint::context::EarlyContext<'a> as syntax::visit::Visitor<'a>>::visit_mod
22: rustc::lint::context::check_ast_crate
23: rustc::util::common::time
24: rustc_driver::driver::phase_2_configure_and_expand
25: rustc_driver::driver::compile_input
26: rustc_driver::run_compiler_with_pool
27: rustc_driver::driver::spawn_thread_pool
28: rustc_driver::run_compiler
29: syntax::with_globals
30: __rust_maybe_catch_panic
31: rustc_driver::run
32: rustc_driver::main
33: std::rt::lang_start::{{closure}}
34: std::panicking::try::do_call
35: __rust_maybe_catch_panic
36: std::rt::lang_start_internal
37: main
query stack during panic:
end of query stack
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.31.0-nightly (de3d640f5 2018-10-01) running on x86_64-apple-darwin
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 `rs_server`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name rs_server src/main.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=570ddfa143c25928 -C extra-filename=-570ddfa143c25928 --out-dir /Users/joshua/dev/hacklily/server/rs-server/target/debug/deps -C incremental=/Users/joshua/dev/hacklily/server/rs-server/target/debug/incremental -L dependency=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps --extern futures=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps/libfutures-896873aebf27fd84.rlib --extern tokio=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps/libtokio-4702d2f4954beb28.rlib --extern tokio_process=/Users/joshua/dev/hacklily/server/rs-server/target/debug/deps/libtokio_process-5537fdad580af0a3.rlib` (exit code: 101)
Meta
rustc +nightly --version --verbose :
rustc 1.31.0-nightly (de3d640f5 2018-10-01)
binary: rustc
commit-hash: de3d640f59c4fa4a09faf2a8d6b0a812aaa6d6cb
commit-date: 2018-10-01
host: x86_64-apple-darwin
release: 1.31.0-nightly
LLVM version: 8.0