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

cfg(doc) isn't set in build scripts #14601

Closed
maia-s opened this issue Sep 26, 2024 · 1 comment
Closed

cfg(doc) isn't set in build scripts #14601

maia-s opened this issue Sep 26, 2024 · 1 comment
Labels
A-build-scripts Area: build.rs scripts C-bug Category: bug Command-doc

Comments

@maia-s
Copy link

maia-s commented Sep 26, 2024

Problem

I want to skip (building and) linking a native library when generating documentation, because it takes a long time and might fail on docs.rs, but cfg(doc) isn't set in build scripts when generating documentation.

Steps

  1. Create a build script for a crate:
fn main() {
    #[cfg(doc)]
    panic!("doc");
}
  1. Run cargo doc -v
  2. The build script is run, but cfg(doc) isn't true

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.81.0 (2dbb1af 2024-08-20)
release: 1.81.0
commit-hash: 2dbb1af
commit-date: 2024-08-20
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.73+curl-8.8.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Mac OS 15.0.0 [64-bit]

cargo 1.83.0-nightly (c1fa840 2024-08-29)
release: 1.83.0-nightly
commit-hash: c1fa840
commit-date: 2024-08-29
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Mac OS 15.0.0 [64-bit]

@maia-s maia-s added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Sep 26, 2024
@weihanglo
Copy link
Member

Thank you for the report!

Similar requests have been open

At this moment you might need to follow this docs.rs official guide to check whether it is a docs.rs build.

Since this is kinda a dup of those above, I am going to close this. Please let us know if there is a reason to keep this issue open separately. Thanks.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
@weihanglo weihanglo added A-build-scripts Area: build.rs scripts Command-doc and removed S-triage Status: This issue is waiting on initial triage. labels Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-scripts Area: build.rs scripts C-bug Category: bug Command-doc
Projects
None yet
Development

No branches or pull requests

2 participants