Skip to content

Commit dc09a3b

Browse files
committed
v0.40.0
1 parent 4caf7ba commit dc09a3b

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

Diff for: CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
<a name="v0.40.0"></a>
2+
# [v0.40.0](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.40.0) - 2025-04-19
3+
4+
**Breaking Change**: Add `Crate::target` field with information about the target and its features
5+
([rust#139393](https://github.com/rust-lang/rust/pull/139393)).
6+
7+
- Format Version: 44
8+
- Upstream Commit: [`8c50f95cf088c6ccf882a152bd46c090efa3a1c7`](https://github.com/rust-lang/rust/commit/8c50f95cf088c6ccf882a152bd46c090efa3a1c7)
9+
- Diff: [v0.39.0...v0.40.0](https://github.com/rust-lang/rustdoc-types/compare/v0.39.0...v0.40.0)
10+
111
<a name="v0.39.0"></a>
212
# [v0.39.0](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.39.0) - 2025-03-24
313

Diff for: COMMIT.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bafdbcadd5e70e4a1a35647002c30efd315621b4
1+
8c50f95cf088c6ccf882a152bd46c090efa3a1c7

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rustdoc-types"
3-
version = "0.39.0"
3+
version = "0.40.0"
44
edition = "2018"
55
license = "MIT OR Apache-2.0"
66
description = "Types for rustdoc's json output"

Diff for: src/lib.rs

+57-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use serde::{Deserialize, Serialize};
2929
/// This integer is incremented with every breaking change to the API,
3030
/// and is returned along with the JSON blob as [`Crate::format_version`].
3131
/// Consuming code should assert that this value matches the format version(s) that it supports.
32-
pub const FORMAT_VERSION: u32 = 43;
32+
pub const FORMAT_VERSION: u32 = 44;
3333

3434
/// The root of the emitted JSON blob.
3535
///
@@ -51,11 +51,67 @@ pub struct Crate {
5151
pub paths: HashMap<Id, ItemSummary>,
5252
/// Maps `crate_id` of items to a crate name and html_root_url if it exists.
5353
pub external_crates: HashMap<u32, ExternalCrate>,
54+
/// Information about the target for which this documentation was generated
55+
pub target: Target,
5456
/// A single version number to be used in the future when making backwards incompatible changes
5557
/// to the JSON output.
5658
pub format_version: u32,
5759
}
5860

61+
/// Information about a target
62+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
63+
pub struct Target {
64+
/// The target triple for which this documentation was generated
65+
pub triple: String,
66+
/// A list of features valid for use in `#[target_feature]` attributes
67+
/// for the target where this rustdoc JSON was generated.
68+
pub target_features: Vec<TargetFeature>,
69+
}
70+
71+
/// Information about a target feature.
72+
///
73+
/// Rust target features are used to influence code generation, especially around selecting
74+
/// instructions which are not universally supported by the target architecture.
75+
///
76+
/// Target features are commonly enabled by the [`#[target_feature]` attribute][1] to influence code
77+
/// generation for a particular function, and less commonly enabled by compiler options like
78+
/// `-Ctarget-feature` or `-Ctarget-cpu`. Targets themselves automatically enable certain target
79+
/// features by default, for example because the target's ABI specification requires saving specific
80+
/// registers which only exist in an architectural extension.
81+
///
82+
/// Target features can imply other target features: for example, x86-64 `avx2` implies `avx`, and
83+
/// aarch64 `sve2` implies `sve`, since both of these architectural extensions depend on their
84+
/// predecessors.
85+
///
86+
/// Target features can be probed at compile time by [`#[cfg(target_feature)]`][2] or `cfg!(…)`
87+
/// conditional compilation to determine whether a target feature is enabled in a particular
88+
/// context.
89+
///
90+
/// [1]: https://doc.rust-lang.org/stable/reference/attributes/codegen.html#the-target_feature-attribute
91+
/// [2]: https://doc.rust-lang.org/reference/conditional-compilation.html#target_feature
92+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
93+
pub struct TargetFeature {
94+
/// The name of this target feature.
95+
pub name: String,
96+
/// Other target features which are implied by this target feature, if any.
97+
pub implies_features: Vec<String>,
98+
/// If this target feature is unstable, the name of the associated language feature gate.
99+
pub unstable_feature_gate: Option<String>,
100+
/// Whether this feature is globally enabled for this compilation session.
101+
///
102+
/// Target features can be globally enabled implicitly as a result of the target's definition.
103+
/// For example, x86-64 hardware floating point ABIs require saving x87 and SSE2 registers,
104+
/// which in turn requires globally enabling the `x87` and `sse2` target features so that the
105+
/// generated machine code conforms to the target's ABI.
106+
///
107+
/// Target features can also be globally enabled explicitly as a result of compiler flags like
108+
/// [`-Ctarget-feature`][1] or [`-Ctarget-cpu`][2].
109+
///
110+
/// [1]: https://doc.rust-lang.org/beta/rustc/codegen-options/index.html#target-feature
111+
/// [2]: https://doc.rust-lang.org/beta/rustc/codegen-options/index.html#target-cpu
112+
pub globally_enabled: bool,
113+
}
114+
59115
/// Metadata of a crate, either the same crate on which `rustdoc` was invoked, or its dependency.
60116
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
61117
pub struct ExternalCrate {

0 commit comments

Comments
 (0)