-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[doc] Render toolchain version detection in rustdoc (#1944)
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
- Loading branch information
Showing
10 changed files
with
130 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
[package] | ||
edition = "2021" | ||
name = "zerocopy" | ||
version = "0.8.6" | ||
version = "0.8.7" | ||
authors = ["Joshua Liebow-Feeser <[email protected]>"] | ||
description = "Zerocopy makes zero-cost memory manipulation effortless. We write \"unsafe\" so you don't have to." | ||
categories = ["embedded", "encoding", "no-std::no-alloc", "parsing", "rust-patterns"] | ||
|
@@ -31,27 +31,31 @@ exclude = [".*"] | |
# which will be emitted if zerocopy is built with a toolchain version at least | ||
# as high as the specified version. In the emitted `--cfg`, dashes are replaced | ||
# by underscores. | ||
# | ||
# Each name is suffixed with the version it corresponds to. This is a convention | ||
# used in the codebase to make it less likely for us to make mistakes when | ||
# writing `doc_cfg` attributes. | ||
|
||
# From 1.81.0, Rust supports the `core::error::Error` trait. | ||
zerocopy-core-error = "1.81.0" | ||
zerocopy-core-error-1-81-0 = "1.81.0" | ||
|
||
# From 1.78.0, Rust supports the `#[diagnostic::on_unimplemented]` attribute. | ||
zerocopy-diagnostic-on-unimplemented = "1.78.0" | ||
zerocopy-diagnostic-on-unimplemented-1-78-0 = "1.78.0" | ||
|
||
# From 1.61.0, Rust supports generic types with trait bounds in `const fn`. | ||
zerocopy-generic-bounds-in-const-fn = "1.61.0" | ||
zerocopy-generic-bounds-in-const-fn-1-61-0 = "1.61.0" | ||
|
||
# From 1.60.0, Rust supports `cfg(target_has_atomics)`, which allows us to | ||
# detect whether a target supports particular sets of atomics. | ||
zerocopy-target-has-atomics = "1.60.0" | ||
zerocopy-target-has-atomics-1-60-0 = "1.60.0" | ||
|
||
# When the "simd" feature is enabled, include SIMD types from the | ||
# `core::arch::aarch64` module, which was stabilized in 1.59.0. On earlier Rust | ||
# versions, these types require the "simd-nightly" feature. | ||
zerocopy-aarch64-simd = "1.59.0" | ||
zerocopy-aarch64-simd-1-59-0 = "1.59.0" | ||
|
||
# Permit panicking in `const fn`s and calling `Vec::try_reserve`. | ||
zerocopy-panic-in-const-and-vec-try-reserve = "1.57.0" | ||
zerocopy-panic-in-const-and-vec-try-reserve-1-57-0 = "1.57.0" | ||
|
||
[package.metadata.ci] | ||
# The versions of the stable and nightly compiler toolchains to use in CI. | ||
|
@@ -77,13 +81,13 @@ std = ["alloc"] | |
__internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd", "std"] | ||
|
||
[dependencies] | ||
zerocopy-derive = { version = "=0.8.6", path = "zerocopy-derive", optional = true } | ||
zerocopy-derive = { version = "=0.8.7", path = "zerocopy-derive", optional = true } | ||
|
||
# The "associated proc macro pattern" ensures that the versions of zerocopy and | ||
# zerocopy-derive remain equal, even if the 'derive' feature isn't used. | ||
# See: https://github.com/matklad/macro-dep-test | ||
[target.'cfg(any())'.dependencies] | ||
zerocopy-derive = { version = "=0.8.6", path = "zerocopy-derive" } | ||
zerocopy-derive = { version = "=0.8.7", path = "zerocopy-derive" } | ||
|
||
[dev-dependencies] | ||
itertools = "0.11" | ||
|
@@ -97,6 +101,6 @@ testutil = { path = "testutil" } | |
# CI test failures. | ||
trybuild = { version = "=1.0.89", features = ["diff"] } | ||
# In tests, unlike in production, zerocopy-derive is not optional | ||
zerocopy-derive = { version = "=0.8.6", path = "zerocopy-derive" } | ||
zerocopy-derive = { version = "=0.8.7", path = "zerocopy-derive" } | ||
# TODO(#381) Remove this dependency once we have our own layout gadgets. | ||
elain = "0.3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.