about summary refs log tree commit diff
path: root/src/rustdoc-json-types
diff options
context:
space:
mode:
authorAlona Enraght-Moony <code@alona.page>2025-01-20 22:36:58 +0000
committerAlona Enraght-Moony <code@alona.page>2025-01-22 19:29:48 +0000
commit9c0e32bcd2727e95371f20fd7c9b86bc139e478e (patch)
tree6c5fa0d472da94f327c68a59a8c597023da3ed38 /src/rustdoc-json-types
parent9f4d9dc102fee5c1fe8adce2c4a58254cae510f4 (diff)
rustdoc-json: Rename `Path::name` to `path`, and give it path (again).
Closes https://github.com/rust-lang/rust/issues/135600

Effectivly reverts https://github.com/rust-lang/rust/pull/134880
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 5a99977ded5..3b31bd21ce2 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.