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 panics when using -Z rustdoc-scrape-examples=examples on proc-macro crates #10571

Closed
AaronErhardt opened this issue Apr 15, 2022 · 3 comments · Fixed by #11430
Closed
Labels
C-bug Category: bug Z-scrape-examples Nightly: rustdoc scrape examples

Comments

@AaronErhardt
Copy link

Problem

Cargo (nightly) panics when I use -Z rustdoc-scrape-examples=examples, but only on proc-macro crates as it seems. This issue first appeared after rust-lang/rust#94926 was fixed.

The panic occurs here: https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_compile.rs#L1600

Steps

  1. Clone Relm4
  2. Create docs for relm4-macros using cargo +nightly doc -Z rustdoc-scrape-examples=examples -p relm4-macros

This will likely work with any proc-macro crate though, as it does not even start to compile anything before cargo panics.

Possible Solution(s)

No response

Notes

Backtrace

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/tools/cargo/src/cargo/ops/cargo_compile.rs:1600:36
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/e7575f9670f3c837def3d186ae09366c75c7632e/library/core/src/panicking.rs:48:5
   3: <core::iter::adapters::map::Map<core::slice::iter::Iter<cargo::core::compiler::unit::Unit>, cargo::ops::cargo_compile::rebuild_unit_graph_shared::{closure#1}> as core::iter::traits::iterator::Iterator>::fold::<(), core::iter::traits::iterator::Iterator::for_each::call<cargo::core::compiler::unit::Unit, <alloc::vec::Vec<cargo::core::compiler::unit::Unit> as alloc::vec::spec_extend::SpecExtend<cargo::core::compiler::unit::Unit, core::iter::adapters::map::Map<core::slice::iter::Iter<cargo::core::compiler::unit::Unit>, cargo::ops::cargo_compile::rebuild_unit_graph_shared::{closure#1}>>>::spec_extend::{closure#0}>::{closure#0}>
   4: cargo::ops::cargo_compile::rebuild_unit_graph_shared
   5: cargo::ops::cargo_compile::create_bcx
   6: cargo::ops::cargo_compile::compile_ws
   7: cargo::ops::cargo_compile::compile
   8: cargo::ops::cargo_doc::doc
   9: cargo::commands::doc::exec
  10: cargo::cli::main
  11: cargo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Version

cargo 1.62.0-nightly (dba5baf 2022-04-13)
release: 1.62.0-nightly
commit-hash: dba5baf4345858c591517b24801902a062c399f8
commit-date: 2022-04-13
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: OracleLinux 35.0.0 [64-bit]
@Eh2406
Copy link
Contributor

Eh2406 commented Apr 15, 2022

cc @willcrichton

@willcrichton
Copy link
Contributor

willcrichton commented Apr 15, 2022

Ah, sorry for the remaining issue. This should already be fixed by #10343, specifically this change:

https://github.com/rust-lang/cargo/pull/10343/files#diff-98da1b66b532e50e9bca971b453ee7de96b17436de1d7ef3824c9888d55be9bbR1587

If possible, I would just like to get #10343 merged rather than fix this standalone.

@willcrichton
Copy link
Contributor

Note: at some point this got un-fixed in #10343, so I just put up a new PR to fix it in #11423.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Z-scrape-examples Nightly: rustdoc scrape examples
Projects
None yet
4 participants