|
7 | 7 | use rustc_abi::ExternAbi; |
8 | 8 | use rustc_ast::ast; |
9 | 9 | use rustc_attr_parsing::DeprecatedSince; |
10 | | -use rustc_hir::def::{CtorKind, DefKind}; |
| 10 | +use rustc_hir::def::CtorKind; |
11 | 11 | use rustc_hir::def_id::DefId; |
12 | 12 | use rustc_metadata::rendered_const; |
13 | 13 | use rustc_middle::{bug, ty}; |
14 | | -use rustc_span::{Pos, Symbol, sym}; |
| 14 | +use rustc_span::{Pos, Symbol}; |
15 | 15 | use rustdoc_json_types::*; |
16 | 16 |
|
17 | | -use super::FullItemId; |
18 | 17 | use crate::clean::{self, ItemId}; |
19 | 18 | use crate::formats::FormatRenderer; |
20 | 19 | use crate::formats::item_type::ItemType; |
@@ -108,67 +107,6 @@ impl JsonRenderer<'_> { |
108 | 107 | } |
109 | 108 | } |
110 | 109 |
|
111 | | - pub(crate) fn id_from_item_default(&self, item_id: ItemId) -> Id { |
112 | | - self.id_from_item_inner(item_id, None, None) |
113 | | - } |
114 | | - |
115 | | - pub(crate) fn id_from_item_inner( |
116 | | - &self, |
117 | | - item_id: ItemId, |
118 | | - name: Option<Symbol>, |
119 | | - extra: Option<Id>, |
120 | | - ) -> Id { |
121 | | - let make_part = |def_id: DefId, name: Option<Symbol>, extra: Option<Id>| { |
122 | | - let name = match name { |
123 | | - Some(name) => Some(name), |
124 | | - None => { |
125 | | - // We need this workaround because primitive types' DefId actually refers to |
126 | | - // their parent module, which isn't present in the output JSON items. So |
127 | | - // instead, we directly get the primitive symbol |
128 | | - if matches!(self.tcx.def_kind(def_id), DefKind::Mod) |
129 | | - && let Some(prim) = self |
130 | | - .tcx |
131 | | - .get_attrs(def_id, sym::rustc_doc_primitive) |
132 | | - .find_map(|attr| attr.value_str()) |
133 | | - { |
134 | | - Some(prim) |
135 | | - } else { |
136 | | - self.tcx.opt_item_name(def_id) |
137 | | - } |
138 | | - } |
139 | | - }; |
140 | | - |
141 | | - FullItemId { def_id, name, extra } |
142 | | - }; |
143 | | - |
144 | | - let key = match item_id { |
145 | | - ItemId::DefId(did) => (make_part(did, name, extra), None), |
146 | | - ItemId::Blanket { for_, impl_id } => { |
147 | | - (make_part(impl_id, None, None), Some(make_part(for_, name, extra))) |
148 | | - } |
149 | | - ItemId::Auto { for_, trait_ } => { |
150 | | - (make_part(trait_, None, None), Some(make_part(for_, name, extra))) |
151 | | - } |
152 | | - }; |
153 | | - |
154 | | - let mut interner = self.id_interner.borrow_mut(); |
155 | | - let len = interner.len(); |
156 | | - *interner |
157 | | - .entry(key) |
158 | | - .or_insert_with(|| Id(len.try_into().expect("too many items in a crate"))) |
159 | | - } |
160 | | - |
161 | | - pub(crate) fn id_from_item(&self, item: &clean::Item) -> Id { |
162 | | - match item.kind { |
163 | | - clean::ItemKind::ImportItem(ref import) => { |
164 | | - let extra = |
165 | | - import.source.did.map(ItemId::from).map(|i| self.id_from_item_default(i)); |
166 | | - self.id_from_item_inner(item.item_id, item.name, extra) |
167 | | - } |
168 | | - _ => self.id_from_item_inner(item.item_id, item.name, None), |
169 | | - } |
170 | | - } |
171 | | - |
172 | 110 | fn ids(&self, items: impl IntoIterator<Item = clean::Item>) -> Vec<Id> { |
173 | 111 | items |
174 | 112 | .into_iter() |
|
0 commit comments