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 testsuites: Consistently use doc-flags over compile-flags for rustdoc-exclusive flags #137442

Open
fmease opened this issue Feb 22, 2025 · 0 comments
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.

Comments

@fmease
Copy link
Member

fmease commented Feb 22, 2025

If I remember correctly, implementation-wise compile-flags and doc-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, if compile-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 via doc-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.

@fmease fmease added 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. labels Feb 22, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 22, 2025
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

2 participants