Skip to content

Commit

Permalink
Auto merge of rust-lang#131595 - fmease:rustdoc-json-mv-obj-safe-dyn-…
Browse files Browse the repository at this point in the history
…compat, r=aDotInTheVoid

rustdoc-JSON: Rename "object safe" to "dyn compatible"

~~Blocked: Sits atop rust-lang#131594. Only the last commit is relevant.~~ (rebased)

Part of rust-lang#130852.

r? aDotInTheVoid or rustdoc
  • Loading branch information
bors committed Oct 17, 2024
2 parents 798fb83 + 2e6f3bd commit 33d17c2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,12 @@ impl FromClean<clean::Trait> for Trait {
let tcx = renderer.tcx;
let is_auto = trait_.is_auto(tcx);
let is_unsafe = trait_.safety(tcx) == rustc_hir::Safety::Unsafe;
let is_object_safe = trait_.is_dyn_compatible(tcx);
let is_dyn_compatible = trait_.is_dyn_compatible(tcx);
let clean::Trait { items, generics, bounds, .. } = trait_;
Trait {
is_auto,
is_unsafe,
is_object_safe,
is_dyn_compatible,
items: renderer.ids(items),
generics: generics.into_json(renderer),
bounds: bounds.into_json(renderer),
Expand Down
9 changes: 6 additions & 3 deletions src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
/// This integer is incremented with every breaking change to the API,
/// and is returned along with the JSON blob as [`Crate::format_version`].
/// Consuming code should assert that this value matches the format version(s) that it supports.
pub const FORMAT_VERSION: u32 = 35;
pub const FORMAT_VERSION: u32 = 36;

/// The root of the emitted JSON blob.
///
Expand Down Expand Up @@ -1082,8 +1082,11 @@ pub struct Trait {
pub is_auto: bool,
/// Whether the trait is marked as `unsafe`.
pub is_unsafe: bool,
/// Whether the trait is [object safe](https://doc.rust-lang.org/reference/items/traits.html#object-safety).
pub is_object_safe: bool,
// FIXME(dyn_compat_renaming): Update the URL once the Reference is updated and hits stable.
/// Whether the trait is [dyn compatible](https://doc.rust-lang.org/reference/items/traits.html#object-safety)[^1].
///
/// [^1]: Formerly known as "object safe".
pub is_dyn_compatible: bool,
/// Associated [`Item`]s that can/must be implemented by the `impl` blocks.
pub items: Vec<Id>,
/// Information about the type parameters and `where` clauses of the trait.
Expand Down
19 changes: 19 additions & 0 deletions tests/rustdoc-json/traits/is_dyn_compatible.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![no_std]

//@ has "$.index[*][?(@.name=='FooDynIncompatible')]"
//@ is "$.index[*][?(@.name=='FooDynIncompatible')].inner.trait.is_dyn_compatible" false
pub trait FooDynIncompatible {
fn foo() -> Self;
}

//@ has "$.index[*][?(@.name=='BarDynIncompatible')]"
//@ is "$.index[*][?(@.name=='BarDynIncompatible')].inner.trait.is_dyn_compatible" false
pub trait BarDynIncompatible<T> {
fn foo(i: T);
}

//@ has "$.index[*][?(@.name=='FooDynCompatible')]"
//@ is "$.index[*][?(@.name=='FooDynCompatible')].inner.trait.is_dyn_compatible" true
pub trait FooDynCompatible {
fn foo(&self);
}
19 changes: 0 additions & 19 deletions tests/rustdoc-json/traits/is_object_safe.rs

This file was deleted.

0 comments on commit 33d17c2

Please sign in to comment.