Skip to content

Commit 522f48c

Browse files
Improve documentation on GetDefId trait's methods
1 parent d98a72c commit 522f48c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/librustdoc/clean/types.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,10 +1305,20 @@ crate enum TypeKind {
13051305
}
13061306

13071307
crate trait GetDefId {
1308-
/// Doesn't retrieve primitive types `DefId`. Use `def_id_full` if you want it.
1308+
/// Use this method to get the [`DefId`] of a [`clean`] AST node.
1309+
/// This will return [`None`] when called on a primitive [`clean::Type`].
1310+
/// Use [`Self::def_id_full`] if you are calling it on a primitive [`clean::Type`].
1311+
///
1312+
/// [`clean`]: crate::clean
1313+
/// [`clean::Type`]: Type
13091314
fn def_id(&self) -> Option<DefId>;
1310-
/// Retrieves all types' `DefId` (including primitives). If you're not interested about
1311-
/// primitives, use `def_id`.
1315+
1316+
/// Use this method to get the [`DefId`] of a [`clean`] AST node that may be
1317+
/// a primitive [`clean::Type`].
1318+
///
1319+
/// See [`Self::def_id`] for more.
1320+
///
1321+
/// [`clean::Type`]: Type
13121322
fn def_id_full(&self, cache: &Cache) -> Option<DefId>;
13131323
}
13141324

0 commit comments

Comments
 (0)