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 panicked at called Option::unwrap() on a None value #45439

Closed
sebastiencs opened this issue Oct 22, 2017 · 4 comments
Closed

rustc panicked at called Option::unwrap() on a None value #45439

sebastiencs opened this issue Oct 22, 2017 · 4 comments
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@sebastiencs
Copy link

I'm using RLS with emacs.
When I want to edit one of my files, it makes panic rustc.
There is this issue with only one file, if I edit the others files of my project rustc doesn't panic.

the backtrace:

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.22.0-nightly (4279e2b4c 2017-10-21) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20
stack backtrace:
   0:     0x7fba6f610193 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hf4c4774738282ebc
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7fba6f60a8c0 - std::sys_common::backtrace::_print::h67e30cbeb3a9aff5
                               at /checkout/src/libstd/sys_common/backtrace.rs:69
   2:     0x7fba6f61d683 - std::panicking::default_hook::{{closure}}::h9e8882ff54c6d95c
                               at /checkout/src/libstd/sys_common/backtrace.rs:58
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7fba6f61d38a - std::panicking::default_hook::hef8ffb3ced307590
                               at /checkout/src/libstd/panicking.rs:391
   4:     0x7fba6f61db47 - std::panicking::rust_panic_with_hook::h6c9860724e07ee00
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7fba6f61da14 - std::panicking::begin_panic::hf29f0ded487629a6
                               at /checkout/src/libstd/panicking.rs:538
   6:     0x7fba6f61d919 - std::panicking::begin_panic_fmt::h2add77dc33b09548
                               at /checkout/src/libstd/panicking.rs:522
   7:     0x7fba6f61d8aa - rust_begin_unwind
                               at /checkout/src/libstd/panicking.rs:498
   8:     0x7fba6f677800 - core::panicking::panic_fmt::hce5e3e24d2bb0a32
                               at /checkout/src/libcore/panicking.rs:71
   9:     0x7fba6f677736 - core::panicking::panic::h693369892c6fbda8
                               at /checkout/src/libcore/panicking.rs:51
  10:     0x7fba70d6ec2d - rustc_save_analysis::SaveContext::get_field_ref_data::hc4404f8f821b78a8
  11:     0x7fba70d49440 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::process_struct_lit::h4332794ac922427d
  12:     0x7fba70d5abe5 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_expr::h88239744448623a5
  13:     0x7fba70d460db - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::process_method::hb00ea7340dde950c
  14:     0x7fba70d4c886 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O>>::process_impl_item::h11878ebf226da75b
  15:     0x7fba70d5176e - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_item::hc259e6953b1ca7c1
  16:     0x7fba70d517be - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_item::hc259e6953b1ca7c1
  17:     0x7fba70d4d108 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, O> as syntax::visit::Visitor<'l>>::visit_mod::h4f3e9a7d2ab348ac
  18:     0x7fba70d71f80 - <rustc_save_analysis::CallbackHandler<'b> as rustc_save_analysis::SaveHandler>::save::h7f7ba91d4947d064
  19:     0x5593fcff75c9 - <rls::build::rustc::RlsRustcCalls as rustc_driver::CompilerCalls<'a>>::build_controller::{{closure}}::h5d1fccb1e285f6c4
  20:     0x7fba710a0652 - rustc_driver::driver::compile_input::{{closure}}::h9195e4f1b4d07f93
  21:     0x7fba71029d2b - rustc::ty::context::TyCtxt::create_and_enter::h461906de72cb170d
  22:     0x7fba7109e608 - rustc_driver::driver::compile_input::ha5b788f7e127b3fe
  23:     0x7fba710ba52e - rustc_driver::run_compiler::h7b268b04258e705e
  24:     0x5593fcf4c6c9 - std::sys_common::backtrace::__rust_begin_short_backtrace::hff0dd9e89bc34313
  25:     0x5593fcf5042f - std::panicking::try::do_call::hf16f0490e66316d3
  26:     0x7fba6f666fec - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:99
  27:     0x5593fcf9504d - <F as alloc::boxed::FnBox<A>>::call_box::h83e360660c2dd63b
  28:     0x7fba6f61c54b - std::sys::imp::thread::Thread::new::thread_start::h9c877a9bee728ced
                               at /checkout/src/liballoc/boxed.rs:772
                               at /checkout/src/libstd/sys_common/thread.rs:24
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  29:     0x7fba6ef7c36c - start_thread
  30:     0x7fba6e787bbe - __GI___clone
  31:                0x0 - <unknown>

Let me know if you need any other informations

@kennytm kennytm added A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 22, 2017
@kennytm
Copy link
Member

kennytm commented Oct 22, 2017

🤔 We've seen something similar before (#41478). Not a duplicate, but the cause of error is the same: unwrapping a sub-span of type Option<Span> which happened to be None.

let span = self.span_from_span(sub_span.unwrap());

@sebastiencs Could you share the file you were editing that crashes rustc? Thanks!

@estebank estebank added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 11, 2019
@bcampbell
Copy link

I think I've just run into this issue too. I'm compiling a debug version of Thunderbird (on linux), and the build keeps throwing up this error (output wrapped as it is from the mach build system...)

Sorry, no nice easy test case that I can see here.

$ ./mach build
 0:00.28 Clobber not needed.
 0:00.28 Adding make options from /fast/ben/tb/mozilla/mozconfig
    MOZ_OBJDIR=/fast/ben/tb/mozilla/obj-x86_64-pc-linux-gnu
    OBJDIR=/fast/ben/tb/mozilla/obj-x86_64-pc-linux-gnu
    FOUND_MOZCONFIG=/fast/ben/tb/mozilla/mozconfig
    export FOUND_MOZCONFIG
 0:00.29 /usr/bin/make -f client.mk -s
 0:00.46 Elapsed: 0.00s; From dist/public: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.46 Elapsed: 0.00s; From dist/private: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.48 Elapsed: 0.01s; From dist/xpi-stage: Kept 58 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.57 Elapsed: 0.12s; From _tests: Kept 1473 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.63 Elapsed: 0.17s; From dist/bin: Kept 2715 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.77 Elapsed: 0.29s; From dist/include: Kept 6258 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.78 ./buildid.h.stub
 0:00.86 ./source-repo.h.stub
 0:01.24 build/application.ini.stub
 0:01.34 build/application.ini.h.stub
 0:01.44 js/src/frontend/binast/force-cargo-host-program-build
 0:01.44 toolkit/library/rust/force-cargo-library-build
 0:01.44 js/src/rust/force-cargo-library-build
 0:01.44 toolkit/crashreporter/rust/force-cargo-host-library-build
 0:01.44 testing/geckodriver/force-cargo-program-build
 0:01.49     Blocking    Blocking waiting for file lock on package cache lock
 0:01.49  waiting for file lock on package cache lock
 0:01.49     Blocking waiting for file lock on package cache lock
 0:01.51     Blocking waiting for file lock on package cache lock
 0:01.95     Blocking waiting for file lock on package cache lock
 0:02.36     Blocking waiting for file lock on package cache lock
 0:02.74     Blocking waiting for file lock on package cache lock
 0:02.76     Blocking waiting for file lock on package cache lock
 0:02.80     Blocking waiting for file lock on package cache lock
 0:03.06 comm/mail/app
 0:03.23     Blocking waiting for file lock on package cache lock
 0:03.50     Blocking waiting for file lock on package cache lock
 0:03.52     Blocking waiting for file lock on package cache lock
 0:03.52     Blocking waiting for file lock on package cache lock
 0:03.53     Blocking waiting for file lock on package cache lock
 0:03.53     Blocking  waiting for file lock on build directory
 0:03.54   Blocking waiting for file lock on package cache lock
 0:03.54     Finished dev [optimized + debuginfo] target(s) in 2.10s
 0:03.54     Blocking waiting for file lock on package cache lock
 0:03.55     Blocking waiting for file lock on build directory
 0:03.55     Finished dev [optimized + debuginfo] target(s) in 2.11s
 0:03.61    Compiling style v0.0.1 (/fast/ben/tb/mozilla/servo/components/style)
 0:04.04 comm/mail/app/thunderbird
 1:32.24 thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
 1:32.24 stack backtrace:
 1:32.48    0:     0x7fea577c4823 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h6485381528590a55
 1:32.49                                at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
 1:32.49    1:     0x7fea577bc4cb - std::sys_common::backtrace::_print::h49a82ae9552e35c7
 1:32.49                                at src/libstd/sys_common/backtrace.rs:71
 1:32.49    2:     0x7fea577c0a56 - std::panicking::default_hook::{{closure}}::he20974adbefcc046
 1:32.50                                at src/libstd/sys_common/backtrace.rs:59
 1:32.50                                at src/libstd/panicking.rs:197
 1:32.50    3:     0x7fea577c07e9 - std::panicking::default_hook::he4af6af4ac7fef7b
 1:32.50                                at src/libstd/panicking.rs:211
 1:32.50    4:     0x7fea554f9680 - rustc::util::common::panic_hook::h47e7e1f47d58fee8
 1:32.50    5:     0x7fea577c1248 - std::panicking::rust_panic_with_hook::h057ff03eb4c8000f
 1:32.50                                at src/libstd/panicking.rs:478
 1:32.50    6:     0x7fea577c0ce1 - std::panicking::continue_panic_fmt::ha6d6ae144369025b
 1:32.50                                at src/libstd/panicking.rs:381
 1:32.50    7:     0x7fea577c0bc5 - rust_begin_unwind
 1:32.50                                at src/libstd/panicking.rs:308
 1:32.50    8:     0x7fea577e9d9c - core::panicking::panic_fmt::hc4f83bfed80aeabd
 1:32.50                                at src/libcore/panicking.rs:85
 1:32.50    9:     0x7fea577e9cdb - core::panicking::panic::h62fdcfa056e70982
 1:32.50                                at src/libcore/panicking.rs:49
 1:32.50   10:     0x7fea55594b07 - rustc::ty::query::plumbing::<impl rustc::dep_graph::dep_node::DepNode>::cache_on_disk::h235d90ce08144d33
 1:32.50   11:     0x7fea551387e0 - <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h04e9bd0a956328c6
 1:32.50   12:     0x7fea555dfeea - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h6fb1ae03745b62d7
 1:32.50   13:     0x7fea5504b536 - rustc::dep_graph::graph::DepGraph::exec_cache_promotions::h81051aba84c9e86e
 1:32.50   14:     0x7fea519771ab - rustc::dep_graph::graph::DepGraph::with_ignore::h2f171eb9b4dc3a0d
 1:32.50   15:     0x7fea5193ed85 - rustc::util::common::time::h35b9392ec92eda4d
 1:32.50   16:     0x7fea51980dc0 - rustc_incremental::persist::save::save_in::hb558fe5b34642efc
 1:32.50   17:     0x7fea5193eee9 - rustc::util::common::time::h59c1f39bdab7372f
 1:32.50   18:     0x7fea5197fec2 - rustc_incremental::persist::save::save_dep_graph::hff2b87f9f7880928
 1:32.50   19:     0x7fea51c4ecc5 - rustc::util::common::time::he70dede8e4b5d29b
 1:32.50   20:     0x7fea51c73a1e - rustc_codegen_ssa::base::assert_and_save_dep_graph::h1e531df11c3f2d92
 1:32.50   21:     0x7fea4d5ced36 - rustc_codegen_ssa::base::codegen_crate::h62f831815cdf11fd
 1:32.50   22:     0x7fea4d624539 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate::hef05d07cb707dcde
 1:32.50   23:     0x7fea571cdde6 - rustc::util::common::time::h0fbcc227f41e7f6f
 1:32.50   24:     0x7fea57193c3a - rustc_interface::passes::start_codegen::hb08d4fff6b46f5df
 1:32.50   25:     0x7fea57176ac6 - rustc::ty::context::tls::enter_global::h979075051b657993
 1:32.50   26:     0x7fea57194430 - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::hfb73e196d3ef6f7e
 1:32.50   27:     0x7fea57233974 - rustc_interface::passes::create_global_ctxt::{{closure}}::h5bc249452380bb5b
 1:32.51   28:     0x7fea57192f85 - rustc_interface::passes::BoxedGlobalCtxt::enter::h2f56c115baeac6e1
 1:32.51   29:     0x7fea5717bb6f - rustc_interface::queries::Query<T>::compute::h137166c00d774605
 1:32.51   30:     0x7fea57283683 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::ongoing_codegen::h74b31a771a891ecd
 1:32.51   31:     0x7fea57aabe5e - rustc_interface::interface::run_compiler_in_existing_thread_pool::h01017a6213536cb6
 1:32.51   32:     0x7fea57b29da5 - std::thread::local::LocalKey<T>::with::h57e4e9c51937ccb9
 1:32.51   33:     0x7fea57acceb4 - scoped_tls::ScopedKey<T>::set::h581b66761e86975e
 1:32.51   34:     0x7fea57b18801 - syntax::with_globals::h7a79417414defd1b
 1:32.51   35:     0x7fea57a7a414 - std::sys_common::backtrace::__rust_begin_short_backtrace::h81c9d6a59d8e80cf
 1:32.51   36:     0x7fea577d2169 - __rust_maybe_catch_panic
 1:32.51                                at src/libpanic_unwind/lib.rs:85
 1:32.51   37:     0x7fea57aa5e58 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hd1b720554dd4145a
 1:32.51   38:     0x7fea577a336e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h805c3cc89d534c05
 1:32.51                                at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/liballoc/boxed.rs:704
 1:32.51   39:     0x7fea577d0ddf - std::sys::unix::thread::Thread::new::thread_start::h6f10b78f26c98dc6
 1:32.51                                at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/liballoc/boxed.rs:704
 1:32.51                                at src/libstd/sys_common/thread.rs:13
 1:32.51                                at src/libstd/sys/unix/thread.rs:79
 1:32.51   40:     0x7fea5770dfa2 - start_thread
 1:32.51   41:     0x7fea5762d88e - __clone
 1:32.51   42:                0x0 - <unknown>
 1:32.51 query stack during panic:
 1:32.51 end of query stack
 1:33.07 thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
 1:33.07   left: `LLVMing`,
 1:33.07  right: `Codegenning`', src/librustc_codegen_ssa/back/write.rs:1509:21
 1:33.07 stack backtrace:
 1:33.07    0:     0x7fea577c4823 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h6485381528590a55
 1:33.07                                at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
 1:33.07    1:     0x7fea577bc4cb - std::sys_common::backtrace::_print::h49a82ae9552e35c7
 1:33.07                                at src/libstd/sys_common/backtrace.rs:71
 1:33.07    2:     0x7fea577c0a56 - std::panicking::default_hook::{{closure}}::he20974adbefcc046
 1:33.07                                at src/libstd/sys_common/backtrace.rs:59
 1:33.07                                at src/libstd/panicking.rs:197
 1:33.07    3:     0x7fea577c07e9 - std::panicking::default_hook::he4af6af4ac7fef7b
 1:33.07                                at src/libstd/panicking.rs:211
 1:33.07    4:     0x7fea554f9680 - rustc::util::common::panic_hook::h47e7e1f47d58fee8
 1:33.07    5:     0x7fea577c1248 - std::panicking::rust_panic_with_hook::h057ff03eb4c8000f
 1:33.08                                at src/libstd/panicking.rs:478
 1:33.08    6:     0x7fea577c0ce1 - std::panicking::continue_panic_fmt::ha6d6ae144369025b
 1:33.08                                at src/libstd/panicking.rs:381
 1:33.08    7:     0x7fea577c0c2e - std::panicking::begin_panic_fmt::he54eae869ed71eb1
 1:33.08                                at src/libstd/panicking.rs:336
 1:33.08    8:     0x7fea4d4f79aa - std::sys_common::backtrace::__rust_begin_short_backtrace::hfd4f61cbe896c449
 1:33.08    9:     0x7fea4d547f1b - std::panicking::try::do_call::hca59485ee8276411
 1:33.08   10:     0x7fea577d2169 - __rust_maybe_catch_panic
 1:33.08                                at src/libpanic_unwind/lib.rs:85
 1:33.08   11:     0x7fea4d5138c3 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hfebbca42beb71568
 1:33.08   12:     0x7fea577a336e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h805c3cc89d534c05
 1:33.08                                at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/liballoc/boxed.rs:704
 1:33.08   13:     0x7fea577d0ddf - std::sys::unix::thread::Thread::new::thread_start::h6f10b78f26c98dc6
 1:33.08                                at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/liballoc/boxed.rs:704
 1:33.08                                at src/libstd/sys_common/thread.rs:13
 1:33.08                                at src/libstd/sys/unix/thread.rs:79
 1:33.08   14:     0x7fea5770dfa2 - start_thread
 1:33.08   15:     0x7fea5762d88e - __clone
 1:33.08   16:                0x0 - <unknown>
 1:33.08 query stack during panic:
 1:33.08 end of query stack
 1:33.41 error: internal compiler error: unexpected panic
 1:33.41 note: the compiler unexpectedly panicked. this is a bug.
 1:33.41 note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
 1:33.41 note: rustc 1.36.0 (a53f9df32 2019-07-03) running on x86_64-unknown-linux-gnu
 1:33.41 note: compiler flags: -C opt-level=1 -C panic=abort -C debuginfo=2 -C debug-assertions=on -C linker=/fast/ben/tb/mozilla/build/cargo-linker -C incremental -C opt-level=1 -C debuginfo=2 -C force-frame-pointers=yes --crate-type lib
 1:33.41 note: some of the compiler flags provided by cargo are hidden
 1:33.56     Finished dev [optimized + debuginfo] target(s) in 1m 32s
 1:33.58     Finished dev [optimized + debuginfo] target(s) in 1m 32s
 1:33.59 error: Could not compile `style`.
 1:33.59 To learn more, run the command again with --verbose.
 1:33.59 make[4]: *** [/fast/ben/tb/mozilla/config/makefiles/rust.mk:245: force-cargo-library-build] Error 101
 1:33.59 make[3]: *** [/fast/ben/tb/mozilla/config/recurse.mk:74: toolkit/library/rust/target] Error 2
 1:33.59 make[3]: *** Waiting for unfinished jobs....
 1:33.61 make[2]: *** [/fast/ben/tb/mozilla/config/recurse.mk:34: compile] Error 2
 1:33.61 make[1]: *** [/fast/ben/tb/mozilla/config/rules.mk:391: default] Error 2
 1:33.61 make: *** [client.mk:125: build] Error 2
 1:33.62 536 compiler warnings present.

@bcampbell
Copy link

Switching from rustc 1.36.0 to nightly (version 1.38.0-nightly (ad7c55e 2019-08-07) at time of writing) got my build running again. Not sure if much should be read into it - could be loads of other factors involved in the build process - but thought it worth adding :-)

@Centril Centril added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 20, 2020
@jyn514
Copy link
Member

jyn514 commented Feb 19, 2023

Save-analysis has been removed from the compiler.

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants