rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.69k stars 12.75k forks source link

Rustc panic: Option::unwrap() on None at src/librustc/hir/mod.rs:81:37 #70124

Closed ChrisGreenaway closed 4 years ago

ChrisGreenaway commented 4 years ago

Code

Sorry to not provide something more precise, but this was reported to me by Travis here: https://travis-ci.com/github/ChrisGreenaway/cargo-local-registry/jobs/299634154

You can reproduce it with:

git clone https://github.com/ChrisGreenaway/cargo-local-registry.git
cd cargo-local-registry
cargo +nightly build

But it looks like the problem was caused by some code in the docopt crate.

Meta

rustc --version --verbose:

$ rustc +nightly --version --verbose
rustc 1.44.0-nightly (7ceebd98c 2020-03-17)
binary: rustc
commit-hash: 7ceebd98c6a15ae30e772eebb676b63ffa1a8122
commit-date: 2020-03-17
host: x86_64-pc-windows-msvc
release: 1.44.0-nightly
LLVM version: 9.0

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src\librustc\hir\mod.rs:81:37
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.44.0-nightly (7ceebd98c 2020-03-17) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 --crate-type lib

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

error: could not compile `docopt`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
Backtrace

``` $ cargo +nightly build Compiling docopt v1.1.0 thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src\librustc\hir\mod.rs:81:37 stack backtrace: 0: ::fmt 1: core::fmt::write 2: ::fmt 3: std::panicking::take_hook 4: std::panicking::take_hook 5: rustc_driver::report_ice 6: std::panicking::rust_panic_with_hook 7: rust_begin_unwind 8: core::panicking::panic_fmt 9: core::panicking::panic 10: rustc::ty::structural_impls::::lift_to_tcx 11: rustc::ty::::is_object_safe 12: rustc::dep_graph::graph::DepGraph::assert_ignored 13: rustc::ty::query::plumbing::::try_print_query_stack 14: rustc::hir::map::Map::find_entry 15: rustc::hir::map::Map::find 16: ::visit_expr 17: ::visit_foreign_item 18: rustc_passes::dead::check_crate 19: rustc_interface::interface::parse_cfgspecs 20: rustc_interface::queries::Linker::link 21: rustc_interface::passes::QueryContext::print_stats 22: rustc_errors::snippet::MultilineAnnotation::increase_depth 23: as rustc_ast::attr::HasAttrs>::attrs 24: as rustc_ast::attr::HasAttrs>::attrs 25: ::fmt 26: as rustc_ast::attr::HasAttrs>::attrs 27: ::deref 28: as rustc_ast::attr::HasAttrs>::attrs 29: ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error. .Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17 30: std::sys::windows::thread::Thread::new 31: BaseThreadInitThunk 32: RtlUserThreadStart note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.44.0-nightly (7ceebd98c 2020-03-17) running on x86_64-pc-windows-msvc note: compiler flags: -C debuginfo=2 --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [hir_owner] processing `regex` #1 [analysis] running analysis passes on this crate end of query stack error: could not compile `docopt`. To learn more, run the command again with --verbose. ```

jonas-schievink commented 4 years ago

duplicate of https://github.com/rust-lang/rust/issues/70041