docs.rs
docs.rs copied to clipboard
`rustdoc-args` is ignored for proc_macro crates
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:
https://github.com/rust-lang/docs.rs/blob/b0f6feadba64502c8aa68dedc3e20be096c5af23/src/docbuilder/rustwide_builder.rs#L830-L833
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
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.
@Nemo157 Agreed, my description could have been clearer. I updated it to make that point more obvious.
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 :facepalm:. This must be a pretty recent cargo bug, serde_derive built 2023-11-21 isn't affected.
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 https://github.com/rust-lang/cargo/pull/13197