about summary refs log tree commit diff
path: root/src/rustdoc-json-types
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2024-10-11 16:53:46 -0500
committerGitHub <noreply@github.com>2024-10-11 16:53:46 -0500
commit05c0591321f9956c1f0df4785d3737f40cffb598 (patch)
treed0bb13da8ed1ad61ab2ea204ec6cecd753f0f3f3 /src/rustdoc-json-types
parent01e2fff90c7ed19e1d9fb828ebc012e7b9732297 (diff)
parent1e30b5ae45ddf07fc7b6d233964e8eddebdc4ecd (diff)
downloadrust-05c0591321f9956c1f0df4785d3737f40cffb598.tar.gz
rust-05c0591321f9956c1f0df4785d3737f40cffb598.zip
Rollup merge of #130078 - its-the-shrimp:rustdoc-types-compress-ids, r=aDotInTheVoid
rustdoc-json: change item ID's repr from a string to an int

Following [this discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Optimizing.20the.20.60Id.60.20type.20in.20.60rustdoc-types.60), I've changed the repr of `rustdoc_json_types::Id` from a String to a u32, by adding a `clean::ItemId` interner to `JsonRenderer`

r? ``@aDotInTheVoid``
Diffstat (limited to 'src/rustdoc-json-types')
-rw-r--r--src/rustdoc-json-types/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index c8b54728d90..fc64bc98bb9 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -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 = 34;
+pub const FORMAT_VERSION: u32 = 35;
 
 /// The root of the emitted JSON blob.
 ///
@@ -296,9 +296,9 @@ pub enum AssocItemConstraintKind {
 /// Rustdoc makes no guarantees about the inner value of Id's. Applications
 /// should treat them as opaque keys to lookup items, and avoid attempting
 /// to parse them, or otherwise depend on any implementation details.
-#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
 // FIXME(aDotInTheVoid): Consider making this non-public in rustdoc-types.
-pub struct Id(pub String);
+pub struct Id(pub u32);
 
 /// The fundamental kind of an item. Unlike [`ItemEnum`], this does not carry any aditional info.
 ///