@@ -19,7 +19,7 @@ pub(super) type IdInterner = FxHashMap<FullItemId, types::Id>;
19
19
#[ derive( Debug , Clone , Copy , Hash , PartialEq , Eq ) ]
20
20
/// An uninterned id.
21
21
///
22
- /// One of these corresponds to every :
22
+ /// Each one corresponds to exactly one of both :
23
23
/// 1. [`rustdoc_json_types::Item`].
24
24
/// 2. [`rustdoc_json_types::Id`] transitively (as each `Item` has an `Id`).
25
25
///
@@ -42,16 +42,16 @@ pub(super) struct FullItemId {
42
42
/// E.g:
43
43
///
44
44
/// ```rust
45
- /// mod module {
46
- /// pub struct Foo {} // Exists in type namespace
47
- /// pub fn Foo(){} // Exists in value namespace
48
- /// }
45
+ /// mod module {
46
+ /// pub struct Foo {} // Exists in type namespace
47
+ /// pub fn Foo(){} // Exists in value namespace
48
+ /// }
49
+ ///
50
+ /// pub use module::Foo; // Imports both items
51
+ /// ```
49
52
///
50
- /// pub use module::Foo; // Imports both items
51
- /// ```
52
- ///
53
- /// In HIR, the `pub use` is just 1 item, but in rustdoc-json it's 2, so
54
- /// we need to disambiguate.
53
+ /// In HIR, the `pub use` is just 1 item, but in rustdoc-json it's 2, so
54
+ /// we need to disambiguate.
55
55
extra_id : Option < DefId > ,
56
56
57
57
/// Needed for `#[rustc_doc_primitive]` modules.
@@ -76,8 +76,8 @@ impl JsonRenderer<'_> {
76
76
name : Option < Symbol > ,
77
77
imported_id : Option < DefId > ,
78
78
) -> types:: Id {
79
- let ( def_id, mut extra_id) = match item_id {
80
- clean:: ItemId :: DefId ( did) => ( did, None ) ,
79
+ let ( def_id, extra_id) = match item_id {
80
+ clean:: ItemId :: DefId ( did) => ( did, imported_id ) ,
81
81
clean:: ItemId :: Blanket { for_, impl_id } => ( for_, Some ( impl_id) ) ,
82
82
clean:: ItemId :: Auto { for_, trait_ } => ( for_, Some ( trait_) ) ,
83
83
} ;
@@ -101,11 +101,6 @@ impl JsonRenderer<'_> {
101
101
}
102
102
} ;
103
103
104
- if let Some ( imported_id) = imported_id {
105
- assert_eq ! ( extra_id, None , "On an import item, so won't have extra from impl" ) ;
106
- extra_id = Some ( imported_id) ;
107
- }
108
-
109
104
let key = FullItemId { def_id, extra_id, name } ;
110
105
111
106
let mut interner = self . id_interner . borrow_mut ( ) ;
0 commit comments