rustdoc testsuites: Consistently use doc-flags
over compile-flags
for rustdoc-exclusive flags
#137442
Labels
A-contributor-roadblock
Area: Makes things more difficult for new or seasoned contributors to Rust
A-testsuite
Area: The testsuite used to check the correctness of rustc
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
C-discussion
Category: Discussion or questions that doesn't represent real issues.
P-low
Low priority
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
If I remember correctly, implementation-wise
compile-flags
anddoc-flags
are identical, compiletest simply forwards the respective flags to the underlying rustc/rustdoc invocation. So in practice it's merely a convention and show of intent to use one over the other. It's not like we can realistically enforce anything here (we certainly don't want to replicate rust{,do}c's CLI parsing inside compiletest).With that said, I'd like us to consistently use
//@ doc-flags
for registering rustdoc-exclusive flags like--document-{private,hidden}-items
,--crate-version
,--generate-link-to-definition
and keep using//@ compile-flags
for flags that are shared by rustc and rustdoc like--crate-name
,-Cmetadata
in all rustdoc testsuites.My main motivation would be to accommodate external tools that can parse compiletest directives and need to know which flags are okay to pass to rustc and rustdoc respectively.
Concrete example: A tool (that understands compiletest directives) wants to query the actual crate name of a crate it just documented in order to find the index page (
doc/{crate_name}/index.html
). For that it has to query rustc (!) via the print request--print=crate-name
and pass along "verbatim flags" as obtained from e.g.,compile-flags
directives which may contain flags like--crate-name
or--edition
that (may) affect the crate name. However, ifcompile-flags
directives contain rustdoc-specific flags like--generate-link-to-definition
the rustc print request would fail for obvious reasons. If all rustdoc-specific flags were exclusively passed viadoc-flags
the tool wouldn't need to find workarounds for filtering them out.C-discussion: Accept / reject?
Points of contention: (1) Churn inducing, (2) realistically not statically enforceable.
The text was updated successfully, but these errors were encountered: