Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<a name="v0.60.0"></a>
# [v0.60.0](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.59.0) - 2026-06-30

**Breaking change**: Add `default_unstable` field into `Function`, `AssocConst` and `AssocType`.
([rust#158468](https://github.com/rust-lang/rust/pull/158468))

- Format Version: 60
- Upstream Commit: [`bd938c5bfb48fe83ef8f2f54f562c2394c17d89f`](https://github.com/rust-lang/rust/commit/bd938c5bfb48fe83ef8f2f54f562c2394c17d89f)
- Diff: [v0.59.0...v0.60.0](https://github.com/rust-lang/rustdoc-types/compare/v0.59.0..v0.60.0)

<a name="v0.59.0"></a>
# [v0.59.0](https://github.com/rust-lang/rustdoc-types/releases/tag/v0.59.0) - 2026-06-26

**Breaking change**: Add `Item::const_stability` field
Expand Down
2 changes: 1 addition & 1 deletion COMMIT.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f8973b70ce31656cfd69bde2d20e6e8240448080
bd938c5bfb48fe83ef8f2f54f562c2394c17d89f
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rustdoc-types"
version = "0.59.0"
version = "0.60.0"
edition = "2024"
license = "MIT OR Apache-2.0"
description = "Types for rustdoc's json output"
Expand Down
39 changes: 37 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ use serde_derive::{Deserialize, Serialize};
// will instead cause conflicts. See #94591 for more. (This paragraph and the "Latest feature" line
// are deliberately not in a doc comment, because they need not be in public docs.)
//
// Latest feature: Add `Item::const_stability`.
pub const FORMAT_VERSION: u32 = 59;
// Latest feature: Add default-body stability metadata.
pub const FORMAT_VERSION: u32 = 60;

/// The root of the emitted JSON blob.
///
Expand Down Expand Up @@ -287,6 +287,9 @@ pub struct Item {
/// - `#[stable]` and `#[unstable]` attributes: see the [`Self::stability`] field instead.
/// - `#[rustc_const_stable]` and `#[rustc_const_unstable]` attributes:
/// see the [`Self::const_stability`] field instead.
/// - `#[rustc_default_body_unstable]` attributes: instead see `default_unstable` fields on
/// item kinds that can have unstable default values, such as [`Function::default_unstable`],
/// [`ItemEnum::AssocConst::default_unstable`], and [`ItemEnum::AssocType::default_unstable`].
///
/// Attributes appear in pretty-printed Rust form, regardless of their formatting
/// in the original source code. For example:
Expand Down Expand Up @@ -366,6 +369,19 @@ pub enum StabilityLevel {
Unstable,
}

/// Information about an unstable default provided by a trait item.
///
/// Example unstable defaults include:
/// - a stable trait function or method whose body is not stable
/// - a stable trait associated type or const whose default value is not stable
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))]
pub struct ProvidedDefaultUnstable {
/// The feature that must be enabled to use the provided default.
pub feature: String,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))]
Expand All @@ -378,6 +394,9 @@ pub enum StabilityLevel {
/// - `#[stable]` and `#[unstable]`. These are in [`Item::stability`] instead.
/// - `#[rustc_const_stable]` and `#[rustc_const_unstable]`. These are in
/// [`Item::const_stability`] instead.
/// - `#[rustc_default_body_unstable]`. These are in the `default_unstable` field on the appropriate
/// item kinds: [`Function::default_unstable`], [`ItemEnum::AssocConst::default_unstable`],
/// and [`ItemEnum::AssocType::default_unstable`].
pub enum Attribute {
/// `#[non_exhaustive]`
NonExhaustive,
Expand Down Expand Up @@ -874,6 +893,11 @@ pub enum ItemEnum {
/// // ^^^^^^^^^^
/// ```
value: Option<String>,
/// Metadata about an unstable default value provided for the associated constant, if any.
///
/// Empty if the associated constant has no default (see [`ItemEnum::AssocConst::value`]),
/// or if the default value is stable.
default_unstable: Option<Box<ProvidedDefaultUnstable>>,
},
/// An associated type of a trait or a type.
AssocType {
Expand All @@ -898,6 +922,11 @@ pub enum ItemEnum {
/// ```
#[serde(rename = "type")]
type_: Option<Type>,
/// Metadata about an unstable default value provided for the associated type, if any.
///
/// Empty if the associated type has no default (see [`ItemEnum::AssocType::type_`]),
/// or if the default value is stable.
default_unstable: Option<Box<ProvidedDefaultUnstable>>,
},
}

Expand Down Expand Up @@ -1187,6 +1216,12 @@ pub struct Function {
pub header: FunctionHeader,
/// Whether the function has a body, i.e. an implementation.
pub has_body: bool,
/// Metadata about a possible unstable provided default implementation for trait methods.
///
/// Only populated for function items inside traits. Empty if the trait method
/// does not have a default implementation (see [`Function::has_body`]),
/// or if its default implementation is stable.
pub default_unstable: Option<Box<ProvidedDefaultUnstable>>,
}

/// Generic parameters accepted by an item and `where` clauses imposed on it and the parameters.
Expand Down