Skip to content

thread 'rustc' panicked at 'already borrowed: BorrowMutError', libcore/result.rs:945:5 #47972

Closed
@PaulGrandperrin

Description

@PaulGrandperrin

Hi, I'm hitting a kind of transient bug:

  • appears seemingly randomly
  • then is 100% reproducible if you don't touch anything
  • then disappears when doing cargo clean

It's the second time I'm hitting it. The first time I made by mistake a change to my environment and the bug disappeared before I could get a backtrace of it. I don't remember exactly how and when it first appeared but I think it was unrelated to this new instance.

I would say it looks like it's related to incremental compilation.

I made a huge tar of my environment (.rustup .cargo and project) before doing a cargo clean, so if needed I can share it somewhere to reproduce.

I was using a locally compiled rustc from #47828 at the time, but the other time I got it, it was with a recent official nightly.

rustc 1.25.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.25.0-dev
LLVM version: 6.0

cc: @eddyb because we spoke about it on IRC

Here is the full backtrace:

paulg@debian ~/P/r/src> env RUST_BACKTRACE=full cargo run --features "instrumentation" --verbose
       Fresh cfg-if v0.1.2
       Fresh futures-await-await-macro v0.1.0
       Fresh rustc-demangle v0.1.5
       Fresh either v1.4.0
       Fresh byteorder v1.2.1
       Fresh futures v0.1.18
       Fresh slab v0.4.0
       Fresh unicode-xid v0.0.4
       Fresh cc v1.0.4
       Fresh libc v0.2.36
       Fresh unicode-xid v0.1.0
       Fresh num-traits v0.1.42
       Fresh quote v0.3.15
       Fresh itertools v0.7.6
       Fresh synom v0.11.3
       Fresh iovec v0.1.2
       Fresh proc-macro2 v0.1.10
       Fresh syn v0.11.11
       Fresh bytes v0.4.6
       Fresh futures-await-quote v0.4.0
       Fresh enum-primitive-derive v0.1.2
       Fresh synstructure v0.6.1
       Fresh backtrace-sys v0.1.16
       Fresh futures-await-synom v0.12.0
       Fresh failure_derive v0.1.1
       Fresh backtrace v0.3.5
       Fresh futures-await-syn v0.12.0
       Fresh failure v0.1.1
       Fresh futures-await-async-macro v0.1.1
       Fresh futures-await v0.1.0
   Compiling reactfs v0.1.0 (file:///home/paulg/Projets/reactfs)
     Running `rustc --crate-name reactfs src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="instrumentation"' -C metadata=bc74da62e3393027 -C extra-filename=-bc74da62e3393027 --out-dir /home/paulg/Projets/reactfs/target/debug/deps -C incremental=/home/paulg/Projets/reactfs/target/debug/incremental -L dependency=/home/paulg/Projets/reactfs/target/debug/deps --extern num_traits=/home/paulg/Projets/reactfs/target/debug/deps/libnum_traits-91d422bec119676e.rlib --extern byteorder=/home/paulg/Projets/reactfs/target/debug/deps/libbyteorder-e390d66463519670.rlib --extern futures=/home/paulg/Projets/reactfs/target/debug/deps/libfutures-292d74a9b9173e00.rlib --extern itertools=/home/paulg/Projets/reactfs/target/debug/deps/libitertools-304d90e56277d5f7.rlib --extern slab=/home/paulg/Projets/reactfs/target/debug/deps/libslab-4a88d95025404389.rlib --extern failure=/home/paulg/Projets/reactfs/target/debug/deps/libfailure-63b1079093d206e3.rlib --extern futures_await=/home/paulg/Projets/reactfs/target/debug/deps/libfutures_await-e7d684946059c77d.rlib --extern bytes=/home/paulg/Projets/reactfs/target/debug/deps/libbytes-bb322e567597addb.rlib --extern enum_primitive_derive=/home/paulg/Projets/reactfs/target/debug/deps/libenum_primitive_derive-0e356ce256d8b220.so --extern reactfs=/home/paulg/Projets/reactfs/target/debug/deps/libreactfs-88d7ac954800cac3.rlib -L native=/home/paulg/Projets/reactfs/target/debug/build/backtrace-sys-70a67d15ed90922a/out/.libs`
error[E0433]: failed to resolve. Could not find `instrumentation` in `core`
  --> src/main.rs:37:8
   |
37 |     core::instrumentation::fuzz_btree(b"");
   |           ^^^^^^^^^^^^^^^ Could not find `instrumentation` in `core`

thread 'rustc' panicked at 'already borrowed: BorrowMutError', libcore/result.rs:945:5
stack backtrace:
   0:     0x7f0de340001b - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h286b8794444c24e0
   1:     0x7f0de33ccee0 - std::sys_common::backtrace::print::h224f0d22b1b51e8c
   2:     0x7f0de33d2f65 - std::panicking::default_hook::{{closure}}::hfe62b839a6606b48
   3:     0x7f0de33d2cc1 - std::panicking::default_hook::h6bf4077c78186846
   4:     0x7f0de33d33a1 - std::panicking::rust_panic_with_hook::hfe94f219d0bc73b3
   5:     0x7f0de33d3262 - std::panicking::begin_panic::hcb9d3389615f930e
   6:     0x7f0de33d3162 - std::panicking::begin_panic_fmt::h3c2e7e0c6de38643
   7:     0x7f0de33d30f1 - rust_begin_unwind
   8:     0x7f0de3472e82 - core::panicking::panic_fmt::h455334a40386cc7c
   9:     0x7f0ddfcbc245 - core::result::unwrap_failed::h3eacb25393b53dcd
  10:     0x7f0ddf9de95b - rustc::ty::maps::on_disk_cache::OnDiskCache::load_diagnostics::h7b42610c81f80e3f
  11:     0x7f0ddfdbd2f3 - rustc::dep_graph::graph::DepGraph::try_mark_green::hd17018d9cd45c700
  12:     0x7f0ddfdbd6ea - rustc::dep_graph::graph::DepGraph::try_mark_green::hd17018d9cd45c700
  13:     0x7f0ddf9dd252 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_mark_green_and_read::h1612a1810dbb6b47
  14:     0x7f0ddf6a4ec7 - rustc::ty::maps::<impl rustc::ty::maps::queries::adt_def<'tcx>>::try_get::hdad1982db995c6e0
  15:     0x7f0ddf91641a - rustc::ty::maps::TyCtxtAt::adt_def::h668c969545fa4695
  16:     0x7f0ddf970daf - serialize::serialize::Decoder::read_enum::h64b43bb79d06e2c7
  17:     0x7f0ddf9fd056 - rustc::ty::maps::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::SpecializedDecoder<&'tcx rustc::ty::TyS<'tcx>> for rustc::ty::maps::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::specialized_decode::had3d86f29fb18219
  18:     0x7f0ddf9e10ec - rustc::ty::maps::on_disk_cache::OnDiskCache::try_load_query_result::h6856f98dff5c9869
  19:     0x7f0ddf69c3ea - rustc::ty::maps::<impl rustc::ty::maps::queries::type_of<'tcx>>::try_get::h9eb2b0ce7b1d773d
  20:     0x7f0ddf915f0f - rustc::ty::maps::TyCtxtAt::type_of::h01a3db5b6203f699
  21:     0x7f0ddf9fee50 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::type_of::h0c94c376681792c7
  22:     0x7f0de1e9b958 - <rustc_typeck::collect::CollectItemTypesVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_item::hf67d6995b4fa1e74
  23:     0x7f0de1ebd66c - rustc::hir::Crate::visit_all_item_likes::h0a4c9c83ce97cf1e
  24:     0x7f0de1ea8487 - rustc::util::common::time::hb8c52e5097c58534
  25:     0x7f0de1f78410 - rustc_typeck::check_crate::hb57d0f09c809136c
  26:     0x7f0de37fedfa - <std::thread::local::LocalKey<T>>::with::h6664f48517e4b7e1
  27:     0x7f0de37ffaf3 - <std::thread::local::LocalKey<T>>::with::h704a26f0a78f0701
  28:     0x7f0de38551ae - rustc::ty::context::TyCtxt::create_and_enter::hae32c8a45b10f266
  29:     0x7f0de376d883 - rustc_driver::driver::compile_input::h290f112545b8616b
  30:     0x7f0de3833cf6 - rustc_driver::run_compiler::h7dbc15974bba2187
  31:     0x7f0de373c258 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha26daf9dd29d125e
  32:     0x7f0de3414129 - __rust_maybe_catch_panic
  33:     0x7f0de379bc87 - <F as alloc::boxed::FnBox<A>>::call_box::h0a954d980a423ec9
  34:     0x7f0de3403cda - std::sys_common::thread::start_thread::hd0eea2f47ffbdc04
  35:     0x7f0de33d3d35 - std::sys::unix::thread::Thread::new::thread_start::hb76f80f796f2d3c9
  36:     0x7f0ddd95b519 - start_thread
  37:     0x7f0de30c03ee - clone
  38:                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.25.0-dev running on x86_64-unknown-linux-gnu

error: Could not compile `reactfs`.

Caused by:
  process didn't exit successfully: `rustc --crate-name reactfs src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg feature="instrumentation" -C metadata=bc74da62e3393027 -C extra-filename=-bc74da62e3393027 --out-dir /home/paulg/Projets/reactfs/target/debug/deps -C incremental=/home/paulg/Projets/reactfs/target/debug/incremental -L dependency=/home/paulg/Projets/reactfs/target/debug/deps --extern num_traits=/home/paulg/Projets/reactfs/target/debug/deps/libnum_traits-91d422bec119676e.rlib --extern byteorder=/home/paulg/Projets/reactfs/target/debug/deps/libbyteorder-e390d66463519670.rlib --extern futures=/home/paulg/Projets/reactfs/target/debug/deps/libfutures-292d74a9b9173e00.rlib --extern itertools=/home/paulg/Projets/reactfs/target/debug/deps/libitertools-304d90e56277d5f7.rlib --extern slab=/home/paulg/Projets/reactfs/target/debug/deps/libslab-4a88d95025404389.rlib --extern failure=/home/paulg/Projets/reactfs/target/debug/deps/libfailure-63b1079093d206e3.rlib --extern futures_await=/home/paulg/Projets/reactfs/target/debug/deps/libfutures_await-e7d684946059c77d.rlib --extern bytes=/home/paulg/Projets/reactfs/target/debug/deps/libbytes-bb322e567597addb.rlib --extern enum_primitive_derive=/home/paulg/Projets/reactfs/target/debug/deps/libenum_primitive_derive-0e356ce256d8b220.so --extern reactfs=/home/paulg/Projets/reactfs/target/debug/deps/libreactfs-88d7ac954800cac3.rlib -L native=/home/paulg/Projets/reactfs/target/debug/build/backtrace-sys-70a67d15ed90922a/out/.libs` (exit code: 101)

Metadata

Metadata

Labels

A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-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