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

[doc] Render toolchain version detection in rustdoc #1944

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Oct 18, 2024

Previously, we had avoided doing this because there wasn't any way to guarantee that we didn't make mistakes and render the wrong version for a particular named toolchain version.

In this commit, we take the pragmatic approach of renaming the named toolchain versions - in particular, we add a suffix which includes the toolchain version. This is fairly error-resistant for two reasons:

  • At the definition site (in Cargo.toml), the name appears on the same line as the version, so mistakes should be obvious
  • At the use site (in various .rs files), the name appears within a few lines of any #[cfg_attr(doc_cfg, doc(cfg(...)))] attribute, so mistakes should similarly be obvious

Release 0.8.7.

Closes #894

@joshlf joshlf requested a review from jswrenn October 18, 2024 20:35
@joshlf
Copy link
Member Author

joshlf commented Oct 18, 2024

This PR generates rustdoc output like:

Screenshot 2024-10-18 at 1 36 05 PM

@joshlf joshlf force-pushed the toolchain-versions-in-rustdoc branch from 2934c82 to 8dbd38a Compare October 18, 2024 20:37
@joshlf joshlf enabled auto-merge October 18, 2024 20:37
Previously, we had avoided doing this because there wasn't any way to
guarantee that we didn't make mistakes and render the wrong version for
a particular named toolchain version.

In this commit, we take the pragmatic approach of renaming the named
toolchain versions - in particular, we add a suffix which includes the
toolchain version. This is fairly error-resistant for two reasons:
- At the definition site (in `Cargo.toml`), the name appears on the same
  line as the version, so mistakes should be obvious
- At the use site (in various `.rs` files), the name appears within a
  few lines of any `#[cfg_attr(doc_cfg, doc(cfg(...)))]` attribute, so
  mistakes should similarly be obvious

Release 0.8.7.

Closes #894

gherrit-pr-id: I74b8e9be0e6cb6e02552d2e1f985b490a7d37afe
@joshlf joshlf force-pushed the toolchain-versions-in-rustdoc branch from 8dbd38a to e435ee7 Compare October 18, 2024 20:54
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.59%. Comparing base (40947c6) to head (e435ee7).

Additional details and impacted files
@@           Coverage Diff           @@
##           v0.8.x    #1944   +/-   ##
=======================================
  Coverage   87.59%   87.59%           
=======================================
  Files          16       16           
  Lines        5988     5988           
=======================================
  Hits         5245     5245           
  Misses        743      743           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joshlf joshlf added this pull request to the merge queue Oct 21, 2024
Merged via the queue into v0.8.x with commit 5c635c6 Oct 21, 2024
87 checks passed
@joshlf joshlf deleted the toolchain-versions-in-rustdoc branch October 21, 2024 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants