Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1f055cd

Browse files
authored
Rollup merge of rust-lang#125130 - aDotInTheVoid:id-docs, r=GuillaumeGomez
rustdoc-json-types: Document `Id` Inspired by finding [someone looking into the internals of an id](rust-lang#91609 (comment)), I realized we only document the fact that these are opaque on [the rfc](https://rust-lang.github.io/rfcs/2963-rustdoc-json.html#id). r? `@GuillaumeGomez`
2 parents 48f1019 + 504bca9 commit 1f055cd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/rustdoc-json-types/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,19 @@ pub enum TypeBindingKind {
188188
Constraint(Vec<GenericBound>),
189189
}
190190

191-
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
191+
/// An opaque identifier for an item.
192+
///
193+
/// It can be used to lookup in [Crate::index] or [Crate::paths] to resolve it
194+
/// to an [Item].
195+
///
196+
/// Id's are only valid within a single JSON blob. They cannot be used to
197+
/// resolve references between the JSON output's for different crates.
198+
///
199+
/// Rustdoc makes no guarantees about the inner value of Id's. Applications
200+
/// should treat them as opaque keys to lookup items, and avoid attempting
201+
/// to parse them, or otherwise depend on any implementation details.
202+
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
203+
// FIXME(aDotInTheVoid): Consider making this non-public in rustdoc-types.
192204
pub struct Id(pub String);
193205

194206
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]

0 commit comments

Comments
 (0)