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

rustdoc-args is ignored for proc_macro crates #2374

Open
dylni opened this issue Dec 30, 2023 · 4 comments
Open

rustdoc-args is ignored for proc_macro crates #2374

dylni opened this issue Dec 30, 2023 · 4 comments
Labels
A-builds Area: Building the documentation for a crate C-bug Category: This is a bug

Comments

@dylni
Copy link

dylni commented Dec 30, 2023

Crate name

attr_alias

Build failure link

https://docs.rs/crate/attr_alias/0.1.0/builds/1075851

Additional details

The build did not fail, but this still appeared to be the best template, as the build did not work as expected.

For proc_macro crates, docs.rs avoids passing --target for builds:

if !metadata.proc_macro {
cargo_args.push("--target".into());
cargo_args.push(target.into());
};

From what I can tell, for library crates, this fixes an issue of rustdoc-args being ignored when passed as build.rustdocflags to rustdoc. However, regardless of whether --target is passed, rustdoc-args is ignored for proc_macro crates.

For example, Cargo.toml for attr_alias includes:

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "attr_alias_docs_rs"]

attr_alias::attr_alias also has the attribute:

#[cfg_attr(attr_alias_docs_rs, doc(cfg(feature = "nightly")))]

Therefore, attr_alias::attr_alias should be documented to require the "nightly" feature, but the note is missing, since rustdoc-args was ignored:
https://docs.rs/attr_alias/0.1.0/attr_alias/attr.attr_alias.html

@dylni dylni changed the title rustdoc-args is ignored for proc\_macro crates rustdoc-args is ignored for proc_macro crates Dec 30, 2023
dylni added a commit to dylni/attr_alias that referenced this issue Dec 30, 2023
dylni added a commit to dylni/attr_alias that referenced this issue Dec 30, 2023
@Nemo157
Copy link
Member

Nemo157 commented Dec 30, 2023

You can see we pass it along to cargo: https://docs.rs/crate/attr_alias/0.1.0/builds/1075851, it must be ignoring it for some reason though, probably related to the weirdness of a --target-less build; I can investigate more tomorrow.

@dylni
Copy link
Author

dylni commented Dec 30, 2023

@Nemo157 Agreed, my description could have been clearer. I updated it to make that point more obvious.

@Nemo157
Copy link
Member

Nemo157 commented Dec 31, 2023

This is much bigger than just the package.metadata.docs.rs.rustdoc-args being ignored, all the additional args we use like --static-root-path are ignored too 🤦. This must be a pretty recent cargo bug, serde_derive built 2023-11-21 isn't affected.

@Nemo157
Copy link
Member

Nemo157 commented Dec 31, 2023

Ah no, it's because attr_alias sets rustc-args which makes us use -Zhost-config -Ztarget-applies-to-host, which then makes build.rustdocflags not apply. This actually needs a soon-to-be-fully-implemented feature of per-target rustdocflags to properly fix rust-lang/cargo#13197

@syphar syphar added C-bug Category: This is a bug A-builds Area: Building the documentation for a crate labels Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builds Area: Building the documentation for a crate C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

3 participants