[go: nahoru, domu]

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

cargo doc currently fails to generate crate documentation #34

Closed
jhodapp opened this issue Oct 13, 2022 · 5 comments
Closed

cargo doc currently fails to generate crate documentation #34

jhodapp opened this issue Oct 13, 2022 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jhodapp
Copy link
Member
jhodapp commented Oct 13, 2022

Description

Currently when running cargo doc crate-level documentation fails to generate. It appears to not be an issue with our particular code, but an issue here is still appropriate to track the fact that Rust docs currently aren't possible to generate and are an important part of this project to fix.

Steps to reproduce

  1. From the root level of the source tree, run cargo doc
  2. Observe the following (or similar output):
Checking unicode-ident v1.0.4
 Documenting unicode-ident v1.0.4
 Documenting void v1.0.2
 Documenting vcell v0.1.3
 Documenting defmt-parser v0.3.1
 Documenting bitfield v0.13.2
    Checking defmt-parser v0.3.1
 Documenting bitflags v1.3.2
 Documenting byteorder v1.4.3
 Documenting cfg-if v1.0.0
 Documenting ufmt-write v0.1.0
 Documenting bare-metal v1.0.0
 Documenting stable_deref_trait v1.2.0
 Documenting volatile-register v0.2.1
    Checking proc-macro2 v1.0.43
 Documenting embedded-hal v0.2.7
 Documenting num-traits v0.2.15
 Documenting proc-macro2 v1.0.43
 Documenting hash32 v0.2.1
 Documenting rtt-target v0.3.1
 Documenting critical-section v0.2.7
    Checking quote v1.0.21
 Documenting cortex-m v0.7.6
    Checking syn v1.0.99
 Documenting quote v1.0.21
 Documenting num-integer v0.1.45
 Documenting num-complex v0.3.1
 Documenting heapless v0.7.16
 Documenting panic-probe v0.3.0
 Documenting cortex-m-semihosting v0.5.0
 Documenting num-rational v0.3.2
 Documenting num-iter v0.1.43
 Documenting syn v1.0.99
 Documenting proc-macro-error-attr v1.0.4
 Documenting num v0.3.1
 Documenting embedded-time v0.12.1
    Checking proc-macro-error v1.0.4
 Documenting proc-macro-error v1.0.4
 Documenting cortex-m-rt-macros v0.7.0
 Documenting defmt-macros v0.3.2
 Documenting cortex-m-rt v0.7.1
 Documenting defmt v0.3.2
 Documenting defmt-rtt v0.3.2
 Documenting esp32-wroom-rp v0.1.0 (/Users/jhodapp/Projects/rust/esp32-wroom-rp/esp32-wroom-rp)
thread 'rustc' panicked at 'no entry found for key', src/librustdoc/passes/collect_intra_doc_links.rs:780:16
stack backtrace:
   0:        0x10628b978 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1543c132bc4e188c
   1:        0x1062d8828 - core::fmt::write::hda8e8eb84b49cbfc
   2:        0x10627ec74 - std::io::Write::write_fmt::hb84c8996aec7120c
   3:        0x10628e5d0 - std::panicking::default_hook::{{closure}}::hdf06011cb093de6a
   4:        0x10628e334 - std::panicking::default_hook::hd7ceb942fff7b170
   5:        0x10d8d8d9c - rustc_driver[8f8caae8abf9e6c7]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x10628eba4 - std::panicking::rust_panic_with_hook::h053d4067a63a6fcb
   7:        0x10628ea3c - std::panicking::begin_panic_handler::{{closure}}::hea9e6c546a23e8ff
   8:        0x10628be54 - std::sys_common::backtrace::__rust_end_short_backtrace::hd64e012cf32134c6
   9:        0x10628e794 - _rust_begin_unwind
  10:        0x106303808 - core::panicking::panic_fmt::hbfde5533e1c0592e
  11:        0x1062d55f8 - core::panicking::panic_display::hf468c4e9dd2e6682
  12:        0x1062d55bc - core::panicking::panic_str::hdef467cea0ece8e3
  13:        0x1063036f0 - core::option::expect_failed::hd1c121064ab29de2
  14:        0x105020208 - rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::resolve_associated_trait_item
  15:        0x10501ee60 - <rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item
  16:        0x10501e294 - <rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::LinkCollector>::resolve
  17:        0x1050214f8 - <rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::LinkCollector as rustdoc[ee9a7b524f118911]::visit::DocVisitor>::visit_item
  18:        0x10502e5a8 - <rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::LinkCollector as rustdoc[ee9a7b524f118911]::visit::DocVisitor>::visit_inner_recur
  19:        0x1050234a0 - <rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::LinkCollector as rustdoc[ee9a7b524f118911]::visit::DocVisitor>::visit_item
  20:        0x10502e544 - <rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::LinkCollector as rustdoc[ee9a7b524f118911]::visit::DocVisitor>::visit_inner_recur
  21:        0x105023524 - <rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::LinkCollector as rustdoc[ee9a7b524f118911]::visit::DocVisitor>::visit_item
  22:        0x10501ce2c - rustdoc[ee9a7b524f118911]::passes::collect_intra_doc_links::collect_intra_doc_links
  23:        0x1050326c4 - <rustc_session[6283a40eea3c7aa9]::session::Session>::time::<rustdoc[ee9a7b524f118911]::clean::types::Crate, rustdoc[ee9a7b524f118911]::core::run_global_ctxt::{closure#8}>
  24:        0x10500950c - rustdoc[ee9a7b524f118911]::core::run_global_ctxt
  25:        0x105036ac8 - <rustc_interface[efe2b5ffa23206d6]::passes::QueryContext>::enter::<rustdoc[ee9a7b524f118911]::main_options::{closure#0}::{closure#0}::{closure#1}, core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>>
  26:        0x104fa097c - <rustc_interface[efe2b5ffa23206d6]::interface::Compiler>::enter::<rustdoc[ee9a7b524f118911]::main_options::{closure#0}::{closure#0}, core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>>
  27:        0x1050ce940 - rustc_span[a44dd0315ec95fe3]::with_source_map::<core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>, rustc_interface[efe2b5ffa23206d6]::interface::create_compiler_and_run<core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>, rustdoc[ee9a7b524f118911]::main_options::{closure#0}>::{closure#1}>
  28:        0x104fcc5d8 - rustc_interface[efe2b5ffa23206d6]::interface::create_compiler_and_run::<core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>, rustdoc[ee9a7b524f118911]::main_options::{closure#0}>
  29:        0x1050d1390 - <scoped_tls[438d350ce76b615a]::ScopedKey<rustc_span[a44dd0315ec95fe3]::SessionGlobals>>::set::<rustdoc[ee9a7b524f118911]::main_args::{closure#0}, core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>>
  30:        0x104f51088 - std[dfd41530add96b74]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[efe2b5ffa23206d6]::util::run_in_thread_pool_with_globals<rustdoc[ee9a7b524f118911]::main_args::{closure#0}, core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>>::{closure#0}, core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>>
  31:        0x104ff6a10 - <<std[dfd41530add96b74]::thread::Builder>::spawn_unchecked_<rustc_interface[efe2b5ffa23206d6]::util::run_in_thread_pool_with_globals<rustdoc[ee9a7b524f118911]::main_args::{closure#0}, core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>>::{closure#0}, core[470b050f2b764c47]::result::Result<(), rustc_errors[b30f6c19c09b5d30]::ErrorGuaranteed>>::{closure#1} as core[470b050f2b764c47]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:        0x1062973dc - std::sys::unix::thread::Thread::new::thread_start::h403ab16d5f453cd4
  33:        0x1884b026c - __pthread_deallocate

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.64.0 (a55dd71d5 2022-09-19) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib

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

query stack during panic:
end of query stack
error: could not document `esp32-wroom-rp`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name esp32_wroom_rp esp32-wroom-rp/src/lib.rs -o /Users/jhodapp/Projects/rust/esp32-wroom-rp/target/doc --cfg 'feature="default"' --cfg 'feature="defmt-default"' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=0ccdb48f377fb2d0 -L dependency=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps --extern cortex_m=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libcortex_m-e1a21cbaac8572f4.rmeta --extern cortex_m_rt=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libcortex_m_rt-6819e5a7cd0e0330.rmeta --extern cortex_m_semihosting=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libcortex_m_semihosting-6a07bdc972b0ce14.rmeta --extern defmt=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libdefmt-53c94002e42dd769.rmeta --extern defmt_rtt=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libdefmt_rtt-7dc77180845a2b6f.rmeta --extern embedded_hal=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libembedded_hal-b124b4ee0f7b537e.rmeta --extern embedded_time=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libembedded_time-1a7ae12a22a40c18.rmeta --extern heapless=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libheapless-839c75bc691be436.rmeta --extern panic_probe=/Users/jhodapp/Projects/rust/esp32-wroom-rp/target/debug/deps/libpanic_probe-39147bf21b928114.rmeta --crate-version 0.1.0` (exit status: 101)

I will also file an upstream bug and link to that here to track progress on a fix to cargo.

@jhodapp jhodapp added the bug Something isn't working label Oct 13, 2022
@jhodapp
Copy link
Member Author
jhodapp commented Oct 13, 2022

@jhodapp
Copy link
Member Author
jhodapp commented Oct 31, 2022

The upstream issue has been resolved, the only work that remains is the verify it through the use of a nightly rustc build. We should also see if we can determine when this fix will become part of stable rustc.

@jhodapp jhodapp added this to the 0.3 Release milestone Oct 31, 2022
@calebbourg calebbourg self-assigned this Nov 3, 2022
@calebbourg
Copy link
Collaborator
calebbourg commented Nov 3, 2022

I assigned this issue to myself to track the progress of this fix.

At the moment the fix for this issue is scheduled to go out with stable Rust v1.66 on Dec. 15th 2022

For now you can generate docs by using the current beta version 1.66

rustup toolchain install beta

rustup override set beta 

cargo doc --open

@jhodapp
Copy link
Member Author
jhodapp commented Nov 3, 2022

Awesome, thanks Caleb for verifying that this does indeed work as a fix for us and detailing how to generate the docs ahead of the stable release.

@calebbourg
Copy link
Collaborator

This fix for this was released into stable yesterday Dec. 15th.

I confirmed that cargo doc --open now works after updating my local Rust toolchain

rustup update
rustup override set stable
cardo doc --open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants