rustdoc testsuites: Consistently use `doc-flags` over `compile-flags` for rustdoc-exclusive flags
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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 flags verbatim 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inventorying rustdoc testsuites and their compiletest directives, focusing on uses of compile-flags and doc-flags with rustdoc-exclusive options such as --document-private-items, --crate-version, and --generate-link-to-definition. Separate shared rustc/rustdoc flags from rustdoc-only flags, then update the relevant directives consistently. Done means rustdoc-only options use doc-flags while shared options remain in compile-flags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100