rust-lang / rust

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

cargo doc unexpectedly error'd out #99218

Closed zancas closed 3 months ago

zancas commented 2 years ago

I run cargo build, and cargo test --workspace without surprising behavior against this commit:

https://github.com/zingolabs/zingolib/pull/43/commits/16f751b25f9740ab73a9e9c176074643bc31ac4a

When I run cargo doc I get the following error:

cargo doc
 Documenting cipher v0.3.0
 Documenting block-buffer v0.10.2
 Documenting crypto-common v0.1.3
 Documenting universal-hash v0.4.1
 Documenting aead v0.4.3
 Documenting rusty-fork v0.3.0
 Documenting webpki v0.22.0
 Documenting sct v0.7.0
 Documenting directories v4.0.1
 Documenting dirs v3.0.2
 Documenting dirs-next v2.0.0
 Documenting clap v2.34.0
 Documenting serde_derive v1.0.137
 Documenting tracing-attributes v0.1.21
 Documenting synstructure v0.12.6
 Documenting tokio-macros v1.8.0
 Documenting futures-macro v0.3.21
 Documenting thiserror-impl v1.0.31
 Documenting pin-project-internal v1.0.10
 Documenting async-trait v0.1.56
 Documenting time-macros-impl v0.1.2
 Documenting async-stream-impl v0.3.3
 Documenting prost-derive v0.10.1
 Documenting derivative v2.2.0
 Documenting fd-lock v3.0.5
 Documenting rand_chacha v0.3.1
 Documenting ff v0.12.0
 Documenting crossbeam-deque v0.8.1
 Documenting num-bigint v0.4.3
 Documenting rand_xorshift v0.3.0
 Documenting password-hash v0.3.2
 Documenting chrono v0.4.19
 Documenting shellwords v1.1.0
 Documenting hdwallet v0.3.1
 Documenting block-modes v0.8.1
 Documenting aes v0.7.5
 Documenting digest v0.10.3
 Documenting async-stream v0.3.3
 Documenting webpki-roots v0.22.3
 Documenting poly1305 v0.7.2
 Documenting zcash_address v0.1.0 (https://github.com/zcash/librustzcash?rev=37fc28634e811fdf8db9274a0080cff17c6b6a09#37fc2863)
 Documenting rust-embed-impl v6.2.0
 Documenting zeroize_derive v1.3.2
 Documenting time-macros v0.1.1
 Documenting futures-util v0.3.21
 Documenting pin-project v1.0.10
 Documenting thiserror v1.0.31
 Documenting prost v0.10.4
 Documenting serde v1.0.137
 Documenting rand v0.8.5
 Documenting group v0.12.0
 Documenting rayon-core v1.9.3
    Checking zingoconfig v0.1.0 (/home/mherder/src/zingolabs/zingolibs/keep_orcharding/config)
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `13907096687038349567`,
 right: `1002111927320821928687967599834759150`', compiler/rustc_query_impl/src/on_disk_cache.rs:540:5
stack backtrace:
   0:     0x7f3c27a9e1cd - std::backtrace_rs::backtrace::libunwind::trace::h22893a5306c091b4
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3c27a9e1cd - std::backtrace_rs::backtrace::trace_unsynchronized::h29c3bc6f9e91819d
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3c27a9e1cd - std::sys_common::backtrace::_print_fmt::he497d8a0ec903793
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3c27a9e1cd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c2a9d2774d81873
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f3c27af801c - core::fmt::write::hba4337c43d992f49
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
   5:     0x7f3c27a8f7c1 - std::io::Write::write_fmt::heb73de6e02cfabed
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
   6:     0x7f3c27aa12b5 - std::sys_common::backtrace::_print::h63c8b24acdd8e8ce
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3c27aa12b5 - std::sys_common::backtrace::print::h426700d6240cdcc2
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3c27aa12b5 - std::panicking::default_hook::{{closure}}::hc9a76eed0b18f82b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
   9:     0x7f3c27aa0f69 - std::panicking::default_hook::h2e88d02087fae196
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
  10:     0x7f3c282ad1d1 - rustc_driver[413d55b6344850e3]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f3c27aa1a00 - std::panicking::rust_panic_with_hook::habfdcc2e90f9fd4c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:702:17
  12:     0x7f3c27aa1837 - std::panicking::begin_panic_handler::{{closure}}::he054b2a83a51d2cd
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:588:13
  13:     0x7f3c27a9e684 - std::sys_common::backtrace::__rust_end_short_backtrace::ha48b94ab49b30915
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f3c27aa1569 - rust_begin_unwind
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
  15:     0x7f3c27a656b3 - core::panicking::panic_fmt::h366d3a309ae17c94
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
  16:     0x7f3c27af4f78 - core::panicking::assert_failed_inner::h92c01a43e8afd9c2
  17:     0x7f3c28bf58ac - core[a3420257622cd381]::panicking::assert_failed::<u128, u128>
  18:     0x7f3c28c1433e - <rustc_query_impl[b0f4194b24b225ee]::on_disk_cache::OnDiskCache as rustc_middle[9ca07169fec39ed9]::ty::context::OnDiskCache>::new
  19:     0x7f3c2a1d2183 - rustc_incremental[e17c2d7fabf89aa]::persist::load::load_query_result_cache::<rustc_query_impl[b0f4194b24b225ee]::on_disk_cache::OnDiskCache>
  20:     0x7f3c2a1af742 - rustc_interface[550884b2b179878f]::passes::create_global_ctxt
  21:     0x7f3c2a1dafc8 - <rustc_interface[550884b2b179878f]::queries::Queries>::global_ctxt
  22:     0x7f3c2a18f9f2 - <rustc_interface[550884b2b179878f]::interface::Compiler>::enter::<rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}::{closure#2}, core[a3420257622cd381]::result::Result<core[a3420257622cd381]::option::Option<rustc_interface[550884b2b179878f]::queries::Linker>, rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>
  23:     0x7f3c2a17503f - rustc_span[7238ca7210ca999e]::with_source_map::<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_interface[550884b2b179878f]::interface::create_compiler_and_run<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#1}>
  24:     0x7f3c2a1910a4 - rustc_interface[550884b2b179878f]::interface::create_compiler_and_run::<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>
  25:     0x7f3c2a1737c2 - <scoped_tls[7ed3ce20ede545d8]::ScopedKey<rustc_span[7238ca7210ca999e]::SessionGlobals>>::set::<rustc_interface[550884b2b179878f]::interface::run_compiler<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>
  26:     0x7f3c2a18938f - std[3b302b3c9093c22]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[550884b2b179878f]::util::run_in_thread_pool_with_globals<rustc_interface[550884b2b179878f]::interface::run_compiler<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>
  27:     0x7f3c2a174af9 - <<std[3b302b3c9093c22]::thread::Builder>::spawn_unchecked_<rustc_interface[550884b2b179878f]::util::run_in_thread_pool_with_globals<rustc_interface[550884b2b179878f]::interface::run_compiler<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>::{closure#1} as core[a3420257622cd381]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x7f3c27aabbf3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha99802c2c52ada61
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/boxed.rs:1861:9
  29:     0x7f3c27aabbf3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha39aea1c57e28a15
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/boxed.rs:1861:9
  30:     0x7f3c27aabbf3 - std::sys::unix::thread::Thread::new::thread_start::h9f8e3d72b1f7662f
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys/unix/thread.rs:108:17
  31:     0x7f3c2768c54d - <unknown>
  32:     0x7f3c27711874 - clone
  33:                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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.61.0 (fe5b13d68 2022-05-18) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
end of query stack
error: could not compile `zingoconfig`
warning: build failed, waiting for other jobs to finish...

Code

cargo doc

Meta

rustc --version --verbose:

rustc --version --verbose
rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-unknown-linux-gnu
release: 1.61.0
LLVM version: 14.0.0
cargo --version --verbose
cargo 1.61.0 (a028ae4 2022-04-29)
release: 1.61.0
commit-hash: a028ae42fc1376571de836be702e840ca8e060c2
commit-date: 2022-04-29
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1m)
os: Arch Linux [64-bit]
saethlin commented 3 months ago

As far as I can tell, the ICE reported in this issue is caused by another process damaging rustc's build artifacts or by a buggy filesystem. That other process could be anything from an IDE running the compiler at the same time as a manual build to a find-and-replace that accidentally edits files in the target directory.

https://github.com/rust-lang/rust/pull/124686 contains a mitigation for this situation; the compiler now has a crude way to detect and ignore damaged incremental compilation files. You will still get a warning about the damaged file, but the build should proceed normally. That change shipped in Rust 1.80 which released today, so I am closing this issue and a few others which as far as I can tell all have the same root cause. You shouldn't see this ICE anymore, but please file a new issue if you see something like it on 1.80 or later.