@@ -120,14 +120,20 @@ impl<'tcx> DocContext<'tcx> {
120
120
r
121
121
}
122
122
123
- // This is an ugly hack, but it's the simplest way to handle synthetic impls without greatly
124
- // refactoring either librustdoc or librustc_middle. In particular, allowing new DefIds to be
125
- // registered after the AST is constructed would require storing the defid mapping in a
126
- // RefCell, decreasing the performance for normal compilation for very little gain.
127
- //
128
- // Instead, we construct 'fake' def ids, which start immediately after the last DefId.
129
- // In the Debug impl for clean::Item, we explicitly check for fake
130
- // def ids, as we'll end up with a panic if we use the DefId Debug impl for fake DefIds
123
+ /// Create a new "fake" [`DefId`].
124
+ ///
125
+ /// This is an ugly hack, but it's the simplest way to handle synthetic impls without greatly
126
+ /// refactoring either rustdoc or [`rustc_middle`]. In particular, allowing new [`DefId`]s
127
+ /// to be registered after the AST is constructed would require storing the [`DefId`] mapping
128
+ /// in a [`RefCell`], decreasing the performance for normal compilation for very little gain.
129
+ ///
130
+ /// Instead, we construct "fake" [`DefId`]s, which start immediately after the last `DefId`.
131
+ /// In the [`Debug`] impl for [`clean::Item`], we explicitly check for fake `DefId`s,
132
+ /// as we'll end up with a panic if we use the `DefId` `Debug` impl for fake `DefId`s.
133
+ ///
134
+ /// [`RefCell`]: std::cell::RefCell
135
+ /// [`Debug`]: std::fmt::Debug
136
+ /// [`clean::Item`]: crate::clean::types::Item
131
137
crate fn next_def_id ( & self , crate_num : CrateNum ) -> DefId {
132
138
let start_def_id = {
133
139
let num_def_ids = if crate_num == LOCAL_CRATE {
0 commit comments