Skip to content

unexpected panic Option::unwrap() on a None value' with NLL #49097

Closed
@estokes

Description

@estokes

This code blows up rustc 1.26.0-nightly (3926453 2018-03-15) with NLL enabled

    if let Some(ref mut txn) = t.model.txn {
        let id = &txn.clone().borrow().id;
        *txn = t.model.db.txnsc.get_from_db(id).expect("failed to find txn");
    }

txn is an Rc<RefCell<...>>

the project is using the following gated features

#![feature(conservative_impl_trait, nll)]

the backtrace from rustc is

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
stack backtrace:
   0:     0x7f4027fcedf3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h6a0bc5605dce4433
                               at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f4027fc5ca4 - std::sys_common::backtrace::_print::h221d36b236e12e74
                               at libstd/sys_common/backtrace.rs:71
   2:     0x7f4027fcb68d - std::panicking::default_hook::{{closure}}::h6e8674dc74aeedd4
                               at libstd/sys_common/backtrace.rs:59
                               at libstd/panicking.rs:207
   3:     0x7f4027fcb389 - std::panicking::default_hook::h746ce9d1b7bb055c
                               at libstd/panicking.rs:223
   4:     0x7f40249dd61d - core::ops::function::Fn::call::hb510ff0d959ce38b
   5:     0x7f4027fcbb29 - std::panicking::rust_panic_with_hook::h9a379049fd32d0d9
                               at libstd/panicking.rs:403
   6:     0x7f4027fcb912 - std::panicking::begin_panic_fmt::h3a9c0b8dcf649e5d
                               at libstd/panicking.rs:349
   7:     0x7f4027fcb842 - rust_begin_unwind
                               at libstd/panicking.rs:325
   8:     0x7f4028031480 - core::panicking::panic_fmt::he867bbf1a3a32159
                               at libcore/panicking.rs:72
   9:     0x7f40280313a6 - core::panicking::panic::ha7e5c9ba9460cc84
                               at libcore/panicking.rs:51
  10:     0x7f402568fea2 - rustc_mir::borrow_check::nll::explain_borrow::<impl rustc_mir::borrow_check::MirBorrowckCtxt<'cx, 'gcx, 'tcx>>::explain_why_borrow_contains_point::hda8c0fdc10302073
  11:     0x7f4025689365 - rustc_mir::borrow_check::error_reporting::<impl rustc_mir::borrow_check::MirBorrowckCtxt<'cx, 'gcx, 'tcx>>::report_borrowed_value_does_not_live_long_enough::h296b170aed634afd
  12:     0x7f40256c56e3 - rustc_mir::borrow_check::MirBorrowckCtxt::access_place::h46ab124bb5de083e
  13:     0x7f40256c364e - rustc_mir::borrow_check::MirBorrowckCtxt::visit_terminator_drop::h00e9df3f184c2630
  14:     0x7f40256c2b36 - <rustc_mir::borrow_check::MirBorrowckCtxt<'cx, 'gcx, 'tcx> as rustc_mir::dataflow::DataflowResultsConsumer<'cx, 'tcx>>::visit_terminator_entry::h5188b3507c6a381e
  15:     0x7f40256c0665 - rustc_mir::borrow_check::do_mir_borrowck::h84250250ee04df6a
  16:     0x7f40256bb68d - rustc_mir::borrow_check::mir_borrowck::h7dcf927a572eee42
  17:     0x7f4024b84a95 - rustc::dep_graph::graph::DepGraph::with_task_impl::haea844def1a03399
  18:     0x7f4024e81d64 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_borrowck<'tcx>>::force::h45ae777ea5b916a7
  19:     0x7f4024e82f54 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_borrowck<'tcx>>::try_get::h43b49267cb704a24
  20:     0x7f4024f815ee - rustc::ty::maps::TyCtxtAt::mir_borrowck::h7ee37d9d8ca6f8ff
  21:     0x7f4024f7dda8 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_borrowck::h2b72e46bb833670b
  22:     0x7f40283978e6 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::{{closure}}::hd81e6c8ab5e99db4
  23:     0x7f402831ba80 - rustc::ty::context::TyCtxt::create_and_enter::h0c78163ea978eb0d
  24:     0x7f402838e401 - rustc_driver::driver::compile_input::haf2922d1e945b5b0
  25:     0x7f40283ab5e5 - rustc_driver::run_compiler::h884712936ee0cb5b
  26:     0x7f40282d3810 - std::sys_common::backtrace::__rust_begin_short_backtrace::hb9742e754f1ab532
  27:     0x7f4027fe498e - __rust_maybe_catch_panic
                               at libpanic_unwind/lib.rs:102
  28:     0x7f402830ea86 - <F as alloc::boxed::FnBox<A>>::call_box::h0248c1537f35c894
  29:     0x7f4027fdbbeb - std::sys::unix::thread::Thread::new::thread_start::h9e86927e52b61050
                               at /checkout/src/liballoc/boxed.rs:793
                               at libstd/sys_common/thread.rs:24
                               at libstd/sys/unix/thread.rs:90
  30:     0x7f4022e527fb - start_thread
  31:     0x7f4027c8fb5e - clone
  32:                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.26.0-nightly (392645394 2018-03-15) 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 `tadbgui`.

Caused by:
  process didn't exit successfully: `rustc --crate-name tadbgui src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=b3b5d6852c4b504f -C extra-filename=-b3b5d6852c4b504f --out-dir home/eric/proj/tadb/tadbgui/target/debug/deps -C incremental=/home/eric/proj/tadb/tadbgui/target/debug/incremental -L dependency=/home/eric/proj/tadb/tadbgui/target/debug/deps --extern mongodb=/home/eric/roj/tadb/tadbgui/target/debug/deps/libmongodb-178b4c7d3b576f52.rlib --extern gtk=/home/eric/proj/tadb/tadbgui/target/debug/deps/libgtk-010a9dc2a7158079.rlib --extern relm=/home/eric/proj/tadb/tadbgui/targt/debug/deps/librelm-e9cb1c98ca20258c.rlib --extern relm_core=/home/eric/proj/tadb/tadbgui/target/debug/deps/librelm_core-331b04e326362724.rlib --extern relm_derive=/home/eric/proj/tadb/tadbgui/target/debg/deps/librelm_derive-fd5648f9c26a756b.so --extern serde_json=/home/eric/proj/tadb/tadbgui/target/debug/deps/libserde_json-84233fa657858fc6.rlib --extern serde_derive=/home/eric/proj/tadb/tadbgui/target/dbug/deps/libserde_derive-4cb8e80d9a73c0be.so --extern serde=/home/eric/proj/tadb/tadbgui/target/debug/deps/libserde-4d70d3b601415d97.rlib --extern futures=/home/eric/proj/tadb/tadbgui/target/debug/deps/lifutures-b43c1d1babca1d76.rlib --extern tadb=/home/eric/proj/tadb/tadbgui/target/debug/deps/libtadb-5dac310c6669872d.rlib --extern error_chain=/home/eric/proj/tadb/tadbgui/target/debug/deps/liberror_chain-8dd17db3364ab0f.rlib --extern bson=/home/eric/proj/tadb/tadbgui/target/debug/deps/libbson-d8225d9ce9d15391.rlib --extern gio=/home/eric/proj/tadb/tadbgui/target/debug/deps/libgio-4996795684e03b71.rlib --etern `glib=/home/eric/proj/tadb/tadbgui/target/debug/deps/libglib-6c140c79d8d74ae9.rlib` --extern chrono=/home/eric/proj/tadb/tadbgui/target/debug/deps/libchrono-262b1c95940ee36b.rlib --extern lazy_static=/ome/eric/proj/tadb/tadbgui/target/debug/deps/liblazy_static-52590beae2f98da0.rlib -L native=/home/eric/proj/tadb/tadbgui/target/debug/build/rust-crypto-2d655f3e8c1c0955/out -L native=/home/eric/proj/tadb/adbgui/target/debug/build/backtrace-sys-0ebacfb9bbb32a44/out/.libs -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linx-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu -L native=/usr/lib/x86_64-linux-gnu` (exit code: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️NLL-completeWorking towards the "valid code works" goal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions