about summary refs log tree commit diff
path: root/src/rustdoc-json-types
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-24 08:08:08 +0100
committerGitHub <noreply@github.com>2025-01-24 08:08:08 +0100
commit40e28582bb95e33f762dea75b78f6ebb5c29b836 (patch)
tree759640bbd7f693628a1fbf62e45b7418e74fa46d /src/rustdoc-json-types
parent042da354e99fb05600c293e12bdfe2b4444eb10b (diff)
parent9c0e32bcd2727e95371f20fd7c9b86bc139e478e (diff)
Rollup merge of #135799 - aDotInTheVoid:skrrt-skrrt-revrrt, r=GuillaumeGomez
rustdoc-json: Rename `Path::name` to `path`, and give it the path again.

Closes: #135600.

Reverts #134880 (Effectively, but not actually, as the `FORMAT_VERSION` needs to be bumped, changed docs/tests). CC `@AS1100K.`

Also CC `@obi1kenobi` `@LukeMathWalker`

Still needs before being merge-ready:
- [x] Tests for cross-crate paths
- [x] (Maybe) Document what the field does.
- [x] Decide if the field rename is good (https://github.com/rust-lang/rust/pull/135799#issuecomment-2605937831)
- [ ] Squash commits.

r? `@GuillaumeGomez`
Diffstat (limited to 'src/rustdoc-json-types')
-rw-r--r--src/rustdoc-json-types/lib.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index 916f0ab3cc8..e67e17a73cb 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -30,7 +30,7 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc
 /// 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 = 38;
+pub const FORMAT_VERSION: u32 = 39;
 
 /// The root of the emitted JSON blob.
 ///
@@ -1036,16 +1036,20 @@ pub enum Type {
 /// A type that has a simple path to it. This is the kind of type of structs, unions, enums, etc.
 #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
 pub struct Path {
-    /// The name of the type as declared, e.g. in
+    /// The path of the type.
+    ///
+    /// This will be the path that is *used* (not where it is defined), so
+    /// multiple `Path`s may have different values for this field even if
+    /// they all refer to the same item. e.g.
     ///
     /// ```rust
-    /// mod foo {
-    ///     struct Bar;
-    /// }
+    /// pub type Vec1 = std::vec::Vec<i32>; // path: "std::vec::Vec"
+    /// pub type Vec2 = Vec<i32>; // path: "Vec"
+    /// pub type Vec3 = std::prelude::v1::Vec<i32>; // path: "std::prelude::v1::Vec"
     /// ```
-    ///
-    /// for `foo::Bar`, this field will be `Bar`.
-    pub name: String,
+    //
+    // Example tested in ./tests/rustdoc-json/path_name.rs
+    pub path: String,
     /// The ID of the type.
     pub id: Id,
     /// Generic arguments to the type.