Skip to content

Commit 90bad38

Browse files
Merge pull request #69 from rust-lang/update
Update to new rustdoc-json output and update crate version to `0.58.0`
2 parents fa2e95b + 8d273db commit 90bad38

5 files changed

Lines changed: 74 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
<a name="v0.58.0"></a>
2+
# [v0.58.0](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.58.0) - 2026-06-24
3+
4+
**Breaking change**: Add `Item::stability` field
5+
([rust#158230](https://github.com/rust-lang/rust/pull/158230))
6+
7+
- Format Version: 57
8+
- Upstream Commit: [`fee82a37e9eabf8afe6db62c0177baaf63356a98`](https://github.com/rust-lang/rust/commit/fee82a37e9eabf8afe6db62c0177baaf63356a98)
9+
- Diff: [v0.57.3...v0.57.4](https://github.com/rust-lang/rustdoc-types/compare/v0.57.3...v0.57.4)
10+
111
<a name="v0.57.4"></a>
212
# [v0.57.4](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.57.4) - 2026-06-19
313

COMMIT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fee82a37e9eabf8afe6db62c0177baaf63356a98
1+
818d29d02798f5e48d28c868e4034294a7a38597

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

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

src/lib.rs

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ use serde_derive::{Deserialize, Serialize};
113113
// will instead cause conflicts. See #94591 for more. (This paragraph and the "Latest feature" line
114114
// are deliberately not in a doc comment, because they need not be in public docs.)
115115
//
116-
// Latest feature: Add `ExternCrate::path`.
117-
pub const FORMAT_VERSION: u32 = 57;
116+
// Latest feature: Add `Item::stability`.
117+
pub const FORMAT_VERSION: u32 = 58;
118118

119119
/// The root of the emitted JSON blob.
120120
///
@@ -281,7 +281,10 @@ pub struct Item {
281281
pub links: HashMap<String, Id>,
282282
/// Attributes on this item.
283283
///
284-
/// Does not include `#[deprecated]` attributes: see the [`Self::deprecation`] field instead.
284+
/// Does not include:
285+
/// - `#[doc = "Doc Comment"]` or `/// Doc comment`: see [`Self::docs`] instead.
286+
/// - `#[deprecated]` attributes: see the [`Self::deprecation`] field instead.
287+
/// - `#[stable]` and `#[unstable]` attributes: see the [`Self::stability`] field instead.
285288
///
286289
/// Attributes appear in pretty-printed Rust form, regardless of their formatting
287290
/// in the original source code. For example:
@@ -293,10 +296,64 @@ pub struct Item {
293296
pub attrs: Vec<Attribute>,
294297
/// Information about the item’s deprecation, if present.
295298
pub deprecation: Option<Deprecation>,
299+
300+
/// Stability information for this item, if any.
301+
///
302+
/// This describes whether the item itself is stable or unstable, as noted by a `#[stable]` or
303+
/// `#[unstable]` attribute. It does not capture const stability, default-body stability, etc.
304+
///
305+
/// Whether a path to an item is stable depends on the stability of containing modules
306+
/// or re-exports along that path. For example, a stable item can be reachable through both an
307+
/// unstable module and a stable re-export.
308+
///
309+
/// For items whose inner kind is [`ItemEnum::Use`], this is the stability of the import itself,
310+
/// not the item being imported. This allows users to determine the stability of paths
311+
/// that involve re-exports.
312+
///
313+
/// Associated items can inherit instability from their enclosing unstable trait or impl.
314+
/// Unannotated associated items in stable traits or impls may have no separate stability value.
315+
///
316+
/// Currently, Rust's `#[stable]` and `#[unstable]` attributes are themselves not stable.
317+
/// As a result, this field is primarily populated for standard-library items;
318+
/// most ordinary third-party crates usually have no data here.
319+
pub stability: Option<Box<Stability>>,
320+
296321
/// The type-specific fields describing this item.
297322
pub inner: ItemEnum,
298323
}
299324

325+
/// Stability information for an item.
326+
///
327+
/// This only refers to regular item stability: whether the item is stable or unstable
328+
/// as represented by the `#[stable]` or `#[unstable]` attributes.
329+
/// Const stability and default-body stability are different things and not captured here.
330+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
331+
#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
332+
#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))]
333+
pub struct Stability {
334+
/// The stability feature associated with this item.
335+
///
336+
/// For unstable items, this is the feature gate associated with the item.
337+
/// For stable items, this is the historical label recorded when the item was stabilized.
338+
pub feature: String,
339+
340+
#[serde(flatten)]
341+
pub level: StabilityLevel,
342+
}
343+
344+
/// Whether an item is stable or unstable as regular public API.
345+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
346+
#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
347+
#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))]
348+
#[serde(tag = "level", rename_all = "snake_case")]
349+
pub enum StabilityLevel {
350+
Stable {
351+
/// The Rust version in which this item became stable, if available.
352+
since: Option<String>,
353+
},
354+
Unstable,
355+
}
356+
300357
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
301358
#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
302359
#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))]
@@ -306,6 +363,7 @@ pub struct Item {
306363
/// This doesn't include:
307364
/// - `#[doc = "Doc Comment"]` or `/// Doc comment`. These are in [`Item::docs`] instead.
308365
/// - `#[deprecated]`. These are in [`Item::deprecation`] instead.
366+
/// - `#[stable]` and `#[unstable]`. These are in [`Item::stability`] instead.
309367
pub enum Attribute {
310368
/// `#[non_exhaustive]`
311369
NonExhaustive,

0 commit comments

Comments
 (0)