Skip to content

'rustc' panicked at 'already borrowed: BorrowMutError' #66785

@ggriffiniii

Description

@ggriffiniii

I was modifying some code, really had no intention of it working and was just running it to see what errors the compiler would tell me about, but the compiler panicked and asked for a bug report so here it is. The in-progress code that causes the panic is here: ggriffiniii/yup-oauth2@9079229

The contents of the panic message are here:

$ RUST_BACKTRACE=full cargo test
   Compiling yup-oauth2 v3.1.1 (/usr/local/google/home/glenng/src/yup-oauth2)
thread 'rustc' panicked at 'already borrowed: BorrowMutError', src/libcore/result.rs:1165:5
stack backtrace:
   0:     0x7fd0db3d7af4 - backtrace::backtrace::libunwind::trace::hda41dbcdfba36aa0
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1:     0x7fd0db3d7af4 - backtrace::backtrace::trace_unsynchronized::h1a8d6e1f8cb3f5d4
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2:     0x7fd0db3d7af4 - std::sys_common::backtrace::_print_fmt::h610c4127487e10da
                               at src/libstd/sys_common/backtrace.rs:76
   3:     0x7fd0db3d7af4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0722dc552e01bd1d
                               at src/libstd/sys_common/backtrace.rs:60
   4:     0x7fd0db41012c - core::fmt::write::h01edf6dd68a42c9c
                               at src/libcore/fmt/mod.rs:1030
   5:     0x7fd0db3cbd17 - std::io::Write::write_fmt::hf15985f193f03c04
                               at src/libstd/io/mod.rs:1412
   6:     0x7fd0db3dc325 - std::sys_common::backtrace::_print::hd8d5d08a1795e743
                               at src/libstd/sys_common/backtrace.rs:64
   7:     0x7fd0db3dc325 - std::sys_common::backtrace::print::hf89a79e3921a2366
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7fd0db3dc325 - std::panicking::default_hook::{{closure}}::h3a8f42beb3bb8ae3
                               at src/libstd/panicking.rs:196
   9:     0x7fd0db3dc016 - std::panicking::default_hook::h8f803b0bc31a5c37
                               at src/libstd/panicking.rs:210
  10:     0x7fd0db913483 - rustc_driver::report_ice::he98718c53edc6d3d
  11:     0x7fd0db3dcb0c - std::panicking::rust_panic_with_hook::h825f041245da8739
                               at src/libstd/panicking.rs:477
  12:     0x7fd0db3dc5c2 - std::panicking::continue_panic_fmt::hbe0378e33481e81b
                               at src/libstd/panicking.rs:380
  13:     0x7fd0db3dc4b6 - rust_begin_unwind
                               at src/libstd/panicking.rs:307
  14:     0x7fd0db409aca - core::panicking::panic_fmt::h527855ce0bc891f6
                               at src/libcore/panicking.rs:85
  15:     0x7fd0db409d07 - core::result::unwrap_failed::ha8b77e6004f0ba38
                               at src/libcore/result.rs:1165
  16:     0x7fd0dbe900fd - rustc_typeck::check::Inherited::register_predicate::h6d6ab2aea880daf6
  17:     0x7fd0dbe902dd - rustc_typeck::check::Inherited::register_predicates::h4e2bca41d54a7f92
  18:     0x7fd0dbe9a7f5 - <rustc_typeck::check::FnCtxt as rustc_typeck::astconv::AstConv>::normalize_ty::h003fa83adb304603
  19:     0x7fd0dbf3965d - <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty::hb5ab16737116477a
  20:     0x7fd0dbf2d011 - <dyn rustc_typeck::astconv::AstConv>::create_substs_for_ast_path::hbcf004e45578b8dd
  21:     0x7fd0dbf29ebe - <dyn rustc_typeck::astconv::AstConv>::ast_path_substs_for_ty::h0fc6ccdaa4a94456
  22:     0x7fd0dbf37afc - <dyn rustc_typeck::astconv::AstConv>::res_to_ty::h838cbf426757fa76
  23:     0x7fd0dbf3965d - <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty::hb5ab16737116477a
  24:     0x7fd0dbea050c - rustc_typeck::check::FnCtxt::check_argument_types::h648ecc2af68d79cc
  25:     0x7fd0dbe8b042 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call::ha7eae76e9c28b73b
  26:     0x7fd0dbe89561 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h45d30abc30b22158
  27:     0x7fd0dbe6fcd8 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::h8b25c6ef69e01f12
  28:     0x7fd0dbe6f28b - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs::h0000f1a19a63396f
  29:     0x7fd0dbea39d8 - rustc_typeck::check::FnCtxt::check_block_with_expected::h0bf314ef8ed232a6
  30:     0x7fd0dbe6fcf3 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::h8b25c6ef69e01f12
  31:     0x7fd0dbe6f28b - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs::h0000f1a19a63396f
  32:     0x7fd0dbe78d9b - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr::h51bf174a038068dd
  33:     0x7fd0dbe91e3d - rustc_typeck::check::check_fn::hb04722ffaefc34ec
  34:     0x7fd0dc00a518 - rustc::ty::context::GlobalCtxt::enter_local::hee87012a37ec7481
  35:     0x7fd0dbe90ea2 - rustc_typeck::check::typeck_tables_of::h7e98a74ad7491971
  36:     0x7fd0dbee24ca - rustc::ty::query::__query_compute::typeck_tables_of::h8235d6e55b8e3584
  37:     0x7fd0dbf7c15b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute::hef02a238f3e43402
  38:     0x7fd0dbf20cc2 - rustc::dep_graph::graph::DepGraph::with_task_impl::hd911b0f10264fdeb
  39:     0x7fd0dbffb551 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hfde020d3574d1a10
  40:     0x7fd0dbf78eaf - rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners::h449b282b3524b717
  41:     0x7fd0dbe9091d - rustc_typeck::check::typeck_item_bodies::h0ba4bbf6daf77150
  42:     0x7fd0dbee2915 - rustc::ty::query::__query_compute::typeck_item_bodies::hd123b7ff5213001d
  43:     0x7fd0dbf1cbf4 - rustc::dep_graph::graph::DepGraph::with_task_impl::hb629a3b21ebb2a85
  44:     0x7fd0dbfc1bed - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h9919cbc7cbdee737
  45:     0x7fd0dbee750e - rustc::util::common::time::h08d6b8e4f10491a9
  46:     0x7fd0dc0b759f - rustc_typeck::check_crate::h2e77f97476aecad8
  47:     0x7fd0db9c200a - rustc_interface::passes::analysis::h7d37d49a7360493d
  48:     0x7fd0db8d5c01 - rustc::ty::query::__query_compute::analysis::h1c5cc76ea5bb496b
  49:     0x7fd0db8be322 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hcf7bc9d073dcb36b
  50:     0x7fd0db8dd42a - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::h7fc0f9f179325408
  51:     0x7fd0dba3e1da - rustc_interface::passes::create_global_ctxt::{{closure}}::h10595b15ffb5db35
  52:     0x7fd0db8df64e - rustc_interface::interface::run_compiler_in_existing_thread_pool::ha009ae4607895a11
  53:     0x7fd0db915362 - std::thread::local::LocalKey<T>::with::h30eaff0b6e71bc49
  54:     0x7fd0db91a3ce - scoped_tls::ScopedKey<T>::set::h6ab0051cc42102a7
  55:     0x7fd0db93b1a2 - syntax::with_globals::h9994c1c3242d3263
  56:     0x7fd0db8a7e10 - std::sys_common::backtrace::__rust_begin_short_backtrace::h229c554686840b66
  57:     0x7fd0db3ed25a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  58:     0x7fd0db8d1879 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hf2e117c529f2753f
  59:     0x7fd0db3be1ff - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h483711add4ba2330
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
  60:     0x7fd0db3ebf00 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h7605b45eb29ed0be
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
  61:     0x7fd0db3ebf00 - std::sys_common::thread::start_thread::h557b0c2dc4449562
                               at src/libstd/sys_common/thread.rs:13
  62:     0x7fd0db3ebf00 - std::sys::unix::thread::Thread::new::thread_start::h7c2a7f9b68fe4bba
                               at src/libstd/sys/unix/thread.rs:79
  63:     0x7fd0db158c73 - start_thread
  64:     0x7fd0daa7edef - clone
  65:                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 incremental

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

query stack during panic:
#0 [typeck_tables_of] processing `authenticator::tests::ensure_send_sync`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `yup-oauth2`.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions