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

rustc panic from unwrapping None #67200

Closed
aklitzke opened this issue Dec 10, 2019 · 5 comments
Closed

rustc panic from unwrapping None #67200

aklitzke opened this issue Dec 10, 2019 · 5 comments

Comments

@aklitzke
Copy link

@aklitzke aklitzke commented Dec 10, 2019

Looks like I encountered a compiler bug. Here's the stacktrace:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
   0:     0x7ff0ab81eaf4 - backtrace::backtrace::libunwind::trace::hda41dbcdfba36aa0
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1:     0x7ff0ab81eaf4 - backtrace::backtrace::trace_unsynchronized::h1a8d6e1f8cb3f5d4
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2:     0x7ff0ab81eaf4 - std::sys_common::backtrace::_print_fmt::h610c4127487e10da
                               at src/libstd/sys_common/backtrace.rs:76
   3:     0x7ff0ab81eaf4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0722dc552e01bd1d
                               at src/libstd/sys_common/backtrace.rs:60
   4:     0x7ff0ab85712c - core::fmt::write::h01edf6dd68a42c9c
                               at src/libcore/fmt/mod.rs:1030
   5:     0x7ff0ab812d17 - std::io::Write::write_fmt::hf15985f193f03c04
                               at src/libstd/io/mod.rs:1412
   6:     0x7ff0ab823325 - std::sys_common::backtrace::_print::hd8d5d08a1795e743
                               at src/libstd/sys_common/backtrace.rs:64
   7:     0x7ff0ab823325 - std::sys_common::backtrace::print::hf89a79e3921a2366
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7ff0ab823325 - std::panicking::default_hook::{{closure}}::h3a8f42beb3bb8ae3
                               at src/libstd/panicking.rs:196
   9:     0x7ff0ab823016 - std::panicking::default_hook::h8f803b0bc31a5c37
                               at src/libstd/panicking.rs:210
  10:     0x7ff0abd5a483 - rustc_driver::report_ice::he98718c53edc6d3d
  11:     0x7ff0ab823b0c - std::panicking::rust_panic_with_hook::h825f041245da8739
                               at src/libstd/panicking.rs:477
  12:     0x7ff0ab8235c2 - std::panicking::continue_panic_fmt::hbe0378e33481e81b
                               at src/libstd/panicking.rs:380
  13:     0x7ff0ab8234b6 - rust_begin_unwind
                               at src/libstd/panicking.rs:307
  14:     0x7ff0ab850aca - core::panicking::panic_fmt::h527855ce0bc891f6
                               at src/libcore/panicking.rs:85
  15:     0x7ff0ab850a09 - core::panicking::panic::h2f49f09cf859b728
                               at src/libcore/panicking.rs:49
  16:     0x7ff0ac2d7fc4 - rustc_typeck::check::typeck_tables_of::h7e98a74ad7491971
  17:     0x7ff0ac3294ca - rustc::ty::query::__query_compute::typeck_tables_of::h8235d6e55b8e3584
  18:     0x7ff0ac3c315b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute::hef02a238f3e43402
  19:     0x7ff0ac367cc2 - rustc::dep_graph::graph::DepGraph::with_task_impl::hd911b0f10264fdeb
  20:     0x7ff0ac442551 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hfde020d3574d1a10
  21:     0x7ff0ad5d95eb - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute::hef02a238f3e43402
  22:     0x7ff0ad15529e - rustc::dep_graph::graph::DepGraph::with_task_impl::he7e3c2c275ef2244
  23:     0x7ff0ad4a557a - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h903a5be3e2161c0c
  24:     0x7ff0ad3a738d - rustc::traits::error_reporting::<impl rustc::infer::InferCtxt>::note_obligation_cause::h2c6cdc829848b452
  25:     0x7ff0ad39f28b - rustc::traits::error_reporting::<impl rustc::infer::InferCtxt>::report_selection_error::he0ecf9fe84056058
  26:     0x7ff0ad397a7c - rustc::traits::error_reporting::<impl rustc::infer::InferCtxt>::report_fulfillment_errors::hbfaf98e94c81acbb
  27:     0x7ff0ac2e57c1 - rustc_typeck::check::FnCtxt::resolve_generator_interiors::hb97defff881a87da
  28:     0x7ff0ac4518ae - rustc::ty::context::GlobalCtxt::enter_local::hee87012a37ec7481
  29:     0x7ff0ac2d7ea2 - rustc_typeck::check::typeck_tables_of::h7e98a74ad7491971
  30:     0x7ff0ac3294ca - rustc::ty::query::__query_compute::typeck_tables_of::h8235d6e55b8e3584
  31:     0x7ff0ac3c315b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute::hef02a238f3e43402
  32:     0x7ff0ac367cc2 - rustc::dep_graph::graph::DepGraph::with_task_impl::hd911b0f10264fdeb
  33:     0x7ff0ac442551 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hfde020d3574d1a10
  34:     0x7ff0ac3294ca - rustc::ty::query::__query_compute::typeck_tables_of::h8235d6e55b8e3584
  35:     0x7ff0ac3c315b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute::hef02a238f3e43402
  36:     0x7ff0ac367cc2 - rustc::dep_graph::graph::DepGraph::with_task_impl::hd911b0f10264fdeb
  37:     0x7ff0ac442551 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hfde020d3574d1a10
  38:     0x7ff0ac4880ae - rustc_typeck::collect::checked_type_of::hd3908c8eaed72ecd
  39:     0x7ff0ac4877dc - rustc_typeck::collect::type_of::h799e995bf65f21ec
  40:     0x7ff0ac32b0b7 - rustc::ty::query::__query_compute::type_of::hb01507aa4b57e392
  41:     0x7ff0ac3c2e5b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute::hd6cd78f07fee48ed
  42:     0x7ff0ac365052 - rustc::dep_graph::graph::DepGraph::with_task_impl::hbdb7bb8db373711b
  43:     0x7ff0ac3d2a04 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h0ad13fb369585832
  44:     0x7ff0ac4a6bf0 - rustc::hir::intravisit::walk_expr::hf4b6465856d88960
  45:     0x7ff0ac466f2c - rustc::hir::intravisit::Visitor::visit_fn::hd86c16bc3957ea4d
  46:     0x7ff0ac4a92f9 - rustc::hir::intravisit::walk_item::h2499ad75ffa206ec
  47:     0x7ff0ac48375d - <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item::h6ecf11c5154ce45d
  48:     0x7ff0ac32e103 - rustc::hir::map::Map::visit_item_likes_in_module::h6cf58cf1c61058c9
  49:     0x7ff0ac483424 - rustc_typeck::collect::collect_mod_item_types::ha8af4c2694cae051
  50:     0x7ff0ac32a44a - rustc::ty::query::__query_compute::collect_mod_item_types::h0959d140ce4a445c
  51:     0x7ff0ac3c334b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute::hcc8bedd87b11d3e0
  52:     0x7ff0ac356f57 - rustc::dep_graph::graph::DepGraph::with_task_impl::h1149bcd7b6e6f8f9
  53:     0x7ff0ac3e51f8 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h1ad8f3fe22fc6341
  54:     0x7ff0ac34e23d - rustc_typeck::check_crate::{{closure}}::{{closure}}::hef852192e4b21571
  55:     0x7ff0ac32e766 - rustc::util::common::time::h6c804872fd5ef88f
  56:     0x7ff0ac4fe3fc - rustc_typeck::check_crate::h2e77f97476aecad8
  57:     0x7ff0abe0900a - rustc_interface::passes::analysis::h7d37d49a7360493d
  58:     0x7ff0abd1cc01 - rustc::ty::query::__query_compute::analysis::h1c5cc76ea5bb496b
  59:     0x7ff0abd05322 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hcf7bc9d073dcb36b
  60:     0x7ff0abd2442a - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::h7fc0f9f179325408
  61:     0x7ff0abe851da - rustc_interface::passes::create_global_ctxt::{{closure}}::h10595b15ffb5db35
  62:     0x7ff0abd2664e - rustc_interface::interface::run_compiler_in_existing_thread_pool::ha009ae4607895a11
  63:     0x7ff0abd5c362 - std::thread::local::LocalKey<T>::with::h30eaff0b6e71bc49
  64:     0x7ff0abd613ce - scoped_tls::ScopedKey<T>::set::h6ab0051cc42102a7
  65:     0x7ff0abd821a2 - syntax::with_globals::h9994c1c3242d3263
  66:     0x7ff0abceee10 - std::sys_common::backtrace::__rust_begin_short_backtrace::h229c554686840b66
  67:     0x7ff0ab83425a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  68:     0x7ff0abd18879 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hf2e117c529f2753f
  69:     0x7ff0ab8051ff - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h483711add4ba2330
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
  70:     0x7ff0ab832f00 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h7605b45eb29ed0be
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
  71:     0x7ff0ab832f00 - std::sys_common::thread::start_thread::h557b0c2dc4449562
                               at src/libstd/sys_common/thread.rs:13
  72:     0x7ff0ab832f00 - std::sys::unix::thread::Thread::new::thread_start::h7c2a7f9b68fe4bba
                               at src/libstd/sys/unix/thread.rs:79
  73:     0x7ff0ab5976ba - start_thread
  74:     0x7ff0aaea741d - clone
  75:                0x0 - <unknown>

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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C ar=arm-linux-gnueabihf-gcc-ar-4.7 -C linker=arm-linux-gnueabihf-g++-4.7 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden
@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Dec 10, 2019

Could you provide the code that caused this? Ideally, a minimal example would be best.

@aklitzke

This comment has been minimized.

Copy link
Author

@aklitzke aklitzke commented Dec 10, 2019

It was quite basic, something like

#[async_std::main]
async fn main() {
  task::spawn(async {
    loop {
      other::crate::async_fn(&"test_string".to_string()).await;
    }
  });
}

removing the .await fixed the problem. Making a syntax error fixed the problem, but guessing compilation quit before the panic.

@jonas-schievink

This comment has been minimized.

Copy link
Member

@jonas-schievink jonas-schievink commented Dec 10, 2019

Likely a duplicate of #67087

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

@nikomatsakis nikomatsakis commented Dec 10, 2019

Visiting from async-await triage: @aklitzke, can you confirm if that example reproduces the problem? Also, it would be great if we can reduce this to an example that doesn't rely on async-std.

Going to leave this as "untriaged" and revisit next week.

@aklitzke

This comment has been minimized.

Copy link
Author

@aklitzke aklitzke commented Dec 10, 2019

I was able to prevent the crash by switching to the nightly build. It then output a compiler error. Fixing the error allowed me to switch back to the stable build.

Based on that, I'm guessing this has already been fixed.

The error after switching to nightly was caused by using task::spawn inside of an async function.

@aklitzke aklitzke closed this Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.