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 rustdoc -Zrustdoc-scrape-examples ignores build.rs failure #11623

Closed
Nemo157 opened this issue Jan 25, 2023 · 0 comments · Fixed by #11694
Closed

cargo rustdoc -Zrustdoc-scrape-examples ignores build.rs failure #11623

Nemo157 opened this issue Jan 25, 2023 · 0 comments · Fixed by #11694
Labels
C-bug Category: bug Z-scrape-examples Nightly: rustdoc scrape examples

Comments

@Nemo157
Copy link
Member

Nemo157 commented Jan 25, 2023

Problem

If a crate's build-script fails when it has examples and -Zrustdoc-scrape-examples is used that failure is ignored and the crate is still attempted to be compiled.

cc @willcrichton

Steps

> cargo new foo && cd foo
     Created binary (application) `foo` package
> echo 'fn main() { panic!("failed") }' > build.rs
> echo 'compile_error!("build script failed, cannot compile");' > src/main.rs
> mkdir examples && echo 'fn main() {}' > examples/foo.rs
> cargo rustdoc
   Compiling foo v0.1.0
error: failed to run custom build command for `foo v0.1.0`

Caused by:
  process didn't exit successfully: `target/debug/build/foo-ba25a7af077036f3/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'failed', build.rs:1:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
> cargo rustdoc -Zrustdoc-scrape-examples
   Compiling foo v0.1.0
    Scraping foo v0.1.0
 Documenting foo v0.1.0
error: build script failed, cannot compile
 --> src/main.rs:1:1
  |
1 | compile_error!("build script failed, cannot compile");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Compilation failed, aborting rustdoc

error: could not document `foo`

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.69.0-nightly (985d561f0 2023-01-20)
release: 1.69.0-nightly
commit-hash: 985d561f0bb9b76ec043a2b12511790ec7a2b954
commit-date: 2023-01-20
host: x86_64-unknown-linux-gnu
libgit2: 1.5.1 (sys:0.16.1 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: Arch Linux [64-bit]
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
Development

Successfully merging a pull request may close this issue.

2 participants