diff options
Diffstat (limited to 'compiler/rustc_save_analysis')
| -rw-r--r-- | compiler/rustc_save_analysis/src/dump_visitor.rs | 144 | ||||
| -rw-r--r-- | compiler/rustc_save_analysis/src/lib.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_save_analysis/src/sig.rs | 34 |
3 files changed, 80 insertions, 112 deletions
diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index 2834e7b6322..625d7c83120 100644 --- a/compiler/rustc_save_analysis/src/dump_visitor.rs +++ b/compiler/rustc_save_analysis/src/dump_visitor.rs @@ -373,14 +373,14 @@ impl<'tcx> DumpVisitor<'tcx> { body: hir::BodyId, ) { let map = &self.tcx.hir(); - self.nest_typeck_results(map.local_def_id(item.hir_id), |v| { + self.nest_typeck_results(item.def_id, |v| { let body = map.body(body); if let Some(fn_data) = v.save_ctxt.get_item_data(item) { down_cast_data!(fn_data, DefData, item.span); v.process_formals(body.params, &fn_data.qualname); - v.process_generic_params(ty_params, &fn_data.qualname, item.hir_id); + v.process_generic_params(ty_params, &fn_data.qualname, item.hir_id()); - v.dumper.dump_def(&access_from!(v.save_ctxt, item, item.hir_id), fn_data); + v.dumper.dump_def(&access_from!(v.save_ctxt, item, item.hir_id()), fn_data); } for arg in decl.inputs { @@ -401,10 +401,10 @@ impl<'tcx> DumpVisitor<'tcx> { typ: &'tcx hir::Ty<'tcx>, expr: &'tcx hir::Expr<'tcx>, ) { - self.nest_typeck_results(self.tcx.hir().local_def_id(item.hir_id), |v| { + self.nest_typeck_results(item.def_id, |v| { if let Some(var_data) = v.save_ctxt.get_item_data(item) { down_cast_data!(var_data, DefData, item.span); - v.dumper.dump_def(&access_from!(v.save_ctxt, item, item.hir_id), var_data); + v.dumper.dump_def(&access_from!(v.save_ctxt, item, item.hir_id()), var_data); } v.visit_ty(&typ); v.visit_expr(expr); @@ -465,10 +465,7 @@ impl<'tcx> DumpVisitor<'tcx> { ) { debug!("process_struct {:?} {:?}", item, item.span); let name = item.ident.to_string(); - let qualname = format!( - "::{}", - self.tcx.def_path_str(self.tcx.hir().local_def_id(item.hir_id).to_def_id()) - ); + let qualname = format!("::{}", self.tcx.def_path_str(item.def_id.to_def_id())); let kind = match item.kind { hir::ItemKind::Struct(_, _) => DefKind::Struct, @@ -500,10 +497,10 @@ impl<'tcx> DumpVisitor<'tcx> { if !self.span.filter_generated(item.ident.span) { let span = self.span_from_span(item.ident.span); self.dumper.dump_def( - &access_from!(self.save_ctxt, item, item.hir_id), + &access_from!(self.save_ctxt, item, item.hir_id()), Def { kind, - id: id_from_hir_id(item.hir_id, &self.save_ctxt), + id: id_from_def_id(item.def_id.to_def_id()), span, name, qualname: qualname.clone(), @@ -518,13 +515,13 @@ impl<'tcx> DumpVisitor<'tcx> { ); } - self.nest_typeck_results(self.tcx.hir().local_def_id(item.hir_id), |v| { + self.nest_typeck_results(item.def_id, |v| { for field in def.fields() { - v.process_struct_field_def(field, item.hir_id); + v.process_struct_field_def(field, item.hir_id()); v.visit_ty(&field.ty); } - v.process_generic_params(ty_params, &qualname, item.hir_id); + v.process_generic_params(ty_params, &qualname, item.hir_id()); }); } @@ -541,7 +538,7 @@ impl<'tcx> DumpVisitor<'tcx> { }; down_cast_data!(enum_data, DefData, item.span); - let access = access_from!(self.save_ctxt, item, item.hir_id); + let access = access_from!(self.save_ctxt, item, item.hir_id()); for variant in enum_definition.variants { let name = variant.ident.name.to_string(); @@ -556,7 +553,7 @@ impl<'tcx> DumpVisitor<'tcx> { if !self.span.filter_generated(name_span) { let span = self.span_from_span(name_span); let id = id_from_hir_id(variant.id, &self.save_ctxt); - let parent = Some(id_from_hir_id(item.hir_id, &self.save_ctxt)); + let parent = Some(id_from_def_id(item.def_id.to_def_id())); self.dumper.dump_def( &access, @@ -596,7 +593,7 @@ impl<'tcx> DumpVisitor<'tcx> { if !self.span.filter_generated(name_span) { let span = self.span_from_span(name_span); let id = id_from_hir_id(variant.id, &self.save_ctxt); - let parent = Some(id_from_hir_id(item.hir_id, &self.save_ctxt)); + let parent = Some(id_from_def_id(item.def_id.to_def_id())); self.dumper.dump_def( &access, @@ -627,7 +624,7 @@ impl<'tcx> DumpVisitor<'tcx> { self.visit_ty(field.ty); } } - self.process_generic_params(ty_params, &enum_data.qualname, item.hir_id); + self.process_generic_params(ty_params, &enum_data.qualname, item.hir_id()); self.dumper.dump_def(&access, enum_data); } @@ -644,17 +641,14 @@ impl<'tcx> DumpVisitor<'tcx> { } let map = &self.tcx.hir(); - self.nest_typeck_results(map.local_def_id(item.hir_id), |v| { + self.nest_typeck_results(item.def_id, |v| { v.visit_ty(&impl_.self_ty); if let Some(trait_ref) = &impl_.of_trait { v.process_path(trait_ref.hir_ref_id, &hir::QPath::Resolved(None, &trait_ref.path)); } - v.process_generic_params(&impl_.generics, "", item.hir_id); + v.process_generic_params(&impl_.generics, "", item.hir_id()); for impl_item in impl_.items { - v.process_impl_item( - map.impl_item(impl_item.id), - map.local_def_id(item.hir_id).to_def_id(), - ); + v.process_impl_item(map.impl_item(impl_item.id), item.def_id.to_def_id()); } }); } @@ -667,10 +661,7 @@ impl<'tcx> DumpVisitor<'tcx> { methods: &'tcx [hir::TraitItemRef], ) { let name = item.ident.to_string(); - let qualname = format!( - "::{}", - self.tcx.def_path_str(self.tcx.hir().local_def_id(item.hir_id).to_def_id()) - ); + let qualname = format!("::{}", self.tcx.def_path_str(item.def_id.to_def_id())); let mut val = name.clone(); if !generics.params.is_empty() { val.push_str(&generic_params_to_string(generics.params)); @@ -680,12 +671,12 @@ impl<'tcx> DumpVisitor<'tcx> { val.push_str(&bounds_to_string(trait_refs)); } if !self.span.filter_generated(item.ident.span) { - let id = id_from_hir_id(item.hir_id, &self.save_ctxt); + let id = id_from_def_id(item.def_id.to_def_id()); let span = self.span_from_span(item.ident.span); let children = - methods.iter().map(|i| id_from_hir_id(i.id.hir_id, &self.save_ctxt)).collect(); + methods.iter().map(|i| id_from_def_id(i.id.def_id.to_def_id())).collect(); self.dumper.dump_def( - &access_from!(self.save_ctxt, item, item.hir_id), + &access_from!(self.save_ctxt, item, item.hir_id()), Def { kind: DefKind::Trait, id, @@ -729,20 +720,17 @@ impl<'tcx> DumpVisitor<'tcx> { kind: RelationKind::SuperTrait, span, from: id_from_def_id(id), - to: id_from_hir_id(item.hir_id, &self.save_ctxt), + to: id_from_def_id(item.def_id.to_def_id()), }); } } } // walk generics and methods - self.process_generic_params(generics, &qualname, item.hir_id); + self.process_generic_params(generics, &qualname, item.hir_id()); for method in methods { let map = &self.tcx.hir(); - self.process_trait_item( - map.trait_item(method.id), - map.local_def_id(item.hir_id).to_def_id(), - ) + self.process_trait_item(map.trait_item(method.id), item.def_id.to_def_id()) } } @@ -750,7 +738,7 @@ impl<'tcx> DumpVisitor<'tcx> { fn process_mod(&mut self, item: &'tcx hir::Item<'tcx>) { if let Some(mod_data) = self.save_ctxt.get_item_data(item) { down_cast_data!(mod_data, DefData, item.span); - self.dumper.dump_def(&access_from!(self.save_ctxt, item, item.hir_id), mod_data); + self.dumper.dump_def(&access_from!(self.save_ctxt, item, item.hir_id()), mod_data); } } @@ -1011,7 +999,7 @@ impl<'tcx> DumpVisitor<'tcx> { let body = body.map(|b| &self.tcx.hir().body(b).value); let respan = respan(vis_span, hir::VisibilityKind::Public); self.process_assoc_const( - trait_item.hir_id, + trait_item.hir_id(), trait_item.ident, &ty, body, @@ -1027,7 +1015,7 @@ impl<'tcx> DumpVisitor<'tcx> { self.process_method( sig, body, - trait_item.hir_id, + trait_item.hir_id(), trait_item.ident, &trait_item.generics, &respan, @@ -1037,15 +1025,12 @@ impl<'tcx> DumpVisitor<'tcx> { hir::TraitItemKind::Type(ref bounds, ref default_ty) => { // FIXME do something with _bounds (for type refs) let name = trait_item.ident.name.to_string(); - let qualname = format!( - "::{}", - self.tcx - .def_path_str(self.tcx.hir().local_def_id(trait_item.hir_id).to_def_id()) - ); + let qualname = + format!("::{}", self.tcx.def_path_str(trait_item.def_id.to_def_id())); if !self.span.filter_generated(trait_item.ident.span) { let span = self.span_from_span(trait_item.ident.span); - let id = id_from_hir_id(trait_item.hir_id, &self.save_ctxt); + let id = id_from_def_id(trait_item.def_id.to_def_id()); self.dumper.dump_def( &Access { public: true, reachable: true }, @@ -1061,7 +1046,7 @@ impl<'tcx> DumpVisitor<'tcx> { decl_id: None, docs: self.save_ctxt.docs_for_attrs(&trait_item.attrs), sig: sig::assoc_type_signature( - trait_item.hir_id, + trait_item.hir_id(), trait_item.ident, Some(bounds), default_ty.as_ref().map(|ty| &**ty), @@ -1088,7 +1073,7 @@ impl<'tcx> DumpVisitor<'tcx> { hir::ImplItemKind::Const(ref ty, body) => { let body = self.tcx.hir().body(body); self.process_assoc_const( - impl_item.hir_id, + impl_item.hir_id(), impl_item.ident, &ty, Some(&body.value), @@ -1101,7 +1086,7 @@ impl<'tcx> DumpVisitor<'tcx> { self.process_method( sig, Some(body), - impl_item.hir_id, + impl_item.hir_id(), impl_item.ident, &impl_item.generics, &impl_item.vis, @@ -1130,7 +1115,7 @@ impl<'tcx> DumpVisitor<'tcx> { .module .item_ids .iter() - .map(|i| id_from_hir_id(i.id, &self.save_ctxt)) + .map(|i| id_from_def_id(i.def_id.to_def_id())) .collect(); let span = self.span_from_span(krate.item.span); @@ -1179,16 +1164,11 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> { hir::ItemKind::Use(path, hir::UseKind::Single) => { let sub_span = path.segments.last().unwrap().ident.span; if !self.span.filter_generated(sub_span) { - let access = access_from!(self.save_ctxt, item, item.hir_id); - let ref_id = self.lookup_def_id(item.hir_id).map(id_from_def_id); + let access = access_from!(self.save_ctxt, item, item.hir_id()); + let ref_id = self.lookup_def_id(item.hir_id()).map(id_from_def_id); let span = self.span_from_span(sub_span); - let parent = self - .save_ctxt - .tcx - .hir() - .opt_local_def_id(item.hir_id) - .and_then(|id| self.save_ctxt.tcx.parent(id.to_def_id())) - .map(id_from_def_id); + let parent = + self.save_ctxt.tcx.parent(item.def_id.to_def_id()).map(id_from_def_id); self.dumper.import( &access, Import { @@ -1206,23 +1186,17 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> { } hir::ItemKind::Use(path, hir::UseKind::Glob) => { // Make a comma-separated list of names of imported modules. - let def_id = self.tcx.hir().local_def_id(item.hir_id); - let names = self.tcx.names_imported_by_glob_use(def_id); + let names = self.tcx.names_imported_by_glob_use(item.def_id); let names: Vec<_> = names.iter().map(|n| n.to_string()).collect(); // Otherwise it's a span with wrong macro expansion info, which // we don't want to track anyway, since it's probably macro-internal `use` if let Some(sub_span) = self.span.sub_span_of_star(item.span) { if !self.span.filter_generated(item.span) { - let access = access_from!(self.save_ctxt, item, item.hir_id); + let access = access_from!(self.save_ctxt, item, item.hir_id()); let span = self.span_from_span(sub_span); - let parent = self - .save_ctxt - .tcx - .hir() - .opt_local_def_id(item.hir_id) - .and_then(|id| self.save_ctxt.tcx.parent(id.to_def_id())) - .map(id_from_def_id); + let parent = + self.save_ctxt.tcx.parent(item.def_id.to_def_id()).map(id_from_def_id); self.dumper.import( &access, Import { @@ -1243,13 +1217,8 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> { let name_span = item.ident.span; if !self.span.filter_generated(name_span) { let span = self.span_from_span(name_span); - let parent = self - .save_ctxt - .tcx - .hir() - .opt_local_def_id(item.hir_id) - .and_then(|id| self.save_ctxt.tcx.parent(id.to_def_id())) - .map(id_from_def_id); + let parent = + self.save_ctxt.tcx.parent(item.def_id.to_def_id()).map(id_from_def_id); self.dumper.import( &Access { public: false, reachable: false }, Import { @@ -1286,20 +1255,17 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> { } hir::ItemKind::Mod(ref m) => { self.process_mod(item); - intravisit::walk_mod(self, m, item.hir_id); + intravisit::walk_mod(self, m, item.hir_id()); } hir::ItemKind::TyAlias(ty, ref generics) => { - let qualname = format!( - "::{}", - self.tcx.def_path_str(self.tcx.hir().local_def_id(item.hir_id).to_def_id()) - ); + let qualname = format!("::{}", self.tcx.def_path_str(item.def_id.to_def_id())); let value = ty_to_string(&ty); if !self.span.filter_generated(item.ident.span) { let span = self.span_from_span(item.ident.span); - let id = id_from_hir_id(item.hir_id, &self.save_ctxt); + let id = id_from_def_id(item.def_id.to_def_id()); self.dumper.dump_def( - &access_from!(self.save_ctxt, item, item.hir_id), + &access_from!(self.save_ctxt, item, item.hir_id()), Def { kind: DefKind::Type, id, @@ -1318,7 +1284,7 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> { } self.visit_ty(ty); - self.process_generic_params(generics, &qualname, item.hir_id); + self.process_generic_params(generics, &qualname, item.hir_id()); } _ => intravisit::walk_item(self, item), } @@ -1382,10 +1348,8 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> { }); } hir::TyKind::OpaqueDef(item_id, _) => { - let item = self.tcx.hir().item(item_id.id); - self.nest_typeck_results(self.tcx.hir().local_def_id(item_id.id), |v| { - v.visit_item(item) - }); + let item = self.tcx.hir().item(item_id); + self.nest_typeck_results(item_id.def_id, |v| v.visit_item(item)); } _ => intravisit::walk_ty(self, t), } @@ -1485,14 +1449,14 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> { } fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem<'tcx>) { - let access = access_from!(self.save_ctxt, item, item.hir_id); + let access = access_from!(self.save_ctxt, item, item.hir_id()); match item.kind { hir::ForeignItemKind::Fn(decl, _, ref generics) => { if let Some(fn_data) = self.save_ctxt.get_extern_item_data(item) { down_cast_data!(fn_data, DefData, item.span); - self.process_generic_params(generics, &fn_data.qualname, item.hir_id); + self.process_generic_params(generics, &fn_data.qualname, item.hir_id()); self.dumper.dump_def(&access, fn_data); } diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index 129123349a0..b3f281bcabc 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -137,7 +137,7 @@ impl<'tcx> SaveContext<'tcx> { } pub fn get_extern_item_data(&self, item: &hir::ForeignItem<'_>) -> Option<Data> { - let def_id = self.tcx.hir().local_def_id(item.hir_id).to_def_id(); + let def_id = item.def_id.to_def_id(); let qualname = format!("::{}", self.tcx.def_path_str(def_id)); match item.kind { hir::ForeignItemKind::Fn(ref decl, arg_names, ref generics) => { @@ -156,7 +156,7 @@ impl<'tcx> SaveContext<'tcx> { unsafety: hir::Unsafety::Unsafe, // functions in extern block cannot be const constness: hir::Constness::NotConst, - abi: self.tcx.hir().get_foreign_abi(item.hir_id), + abi: self.tcx.hir().get_foreign_abi(item.hir_id()), // functions in extern block cannot be async asyncness: hir::IsAsync::NotAsync, }, @@ -201,7 +201,7 @@ impl<'tcx> SaveContext<'tcx> { } pub fn get_item_data(&self, item: &hir::Item<'_>) -> Option<Data> { - let def_id = self.tcx.hir().local_def_id(item.hir_id).to_def_id(); + let def_id = item.def_id.to_def_id(); match item.kind { hir::ItemKind::Fn(ref sig, ref generics, _) => { let qualname = format!("::{}", self.tcx.def_path_str(def_id)); @@ -290,7 +290,11 @@ impl<'tcx> SaveContext<'tcx> { span: self.span_from_span(item.ident.span), value: filename.to_string(), parent: None, - children: m.item_ids.iter().map(|i| id_from_hir_id(i.id, self)).collect(), + children: m + .item_ids + .iter() + .map(|i| id_from_def_id(i.def_id.to_def_id())) + .collect(), decl_id: None, docs: self.docs_for_attrs(&item.attrs), sig: sig::item_signature(item, self), @@ -354,7 +358,7 @@ impl<'tcx> SaveContext<'tcx> { parent: None, children: items .iter() - .map(|i| id_from_hir_id(i.id.hir_id, self)) + .map(|i| id_from_def_id(i.id.def_id.to_def_id())) .collect(), docs: String::new(), sig: None, diff --git a/compiler/rustc_save_analysis/src/sig.rs b/compiler/rustc_save_analysis/src/sig.rs index 8ada7e34fe8..33db189af37 100644 --- a/compiler/rustc_save_analysis/src/sig.rs +++ b/compiler/rustc_save_analysis/src/sig.rs @@ -317,8 +317,8 @@ impl<'hir> Sig for hir::Ty<'hir> { Ok(replace_text(nested_ty, text)) } hir::TyKind::OpaqueDef(item_id, _) => { - let item = scx.tcx.hir().item(item_id.id); - item.make(offset, Some(item_id.id), scx) + let item = scx.tcx.hir().item(item_id); + item.make(offset, Some(item_id.hir_id()), scx) } hir::TyKind::Typeof(_) | hir::TyKind::Infer | hir::TyKind::Err => Err("Ty"), } @@ -327,7 +327,7 @@ impl<'hir> Sig for hir::Ty<'hir> { impl<'hir> Sig for hir::Item<'hir> { fn make(&self, offset: usize, _parent_id: Option<hir::HirId>, scx: &SaveContext<'_>) -> Result { - let id = Some(self.hir_id); + let id = Some(self.hir_id()); match self.kind { hir::ItemKind::Static(ref ty, m, ref body) => { @@ -337,7 +337,7 @@ impl<'hir> Sig for hir::Item<'hir> { } let name = self.ident.to_string(); let defs = vec![SigElement { - id: id_from_hir_id(self.hir_id, scx), + id: id_from_def_id(self.def_id.to_def_id()), start: offset + text.len(), end: offset + text.len() + name.len(), }]; @@ -359,7 +359,7 @@ impl<'hir> Sig for hir::Item<'hir> { let mut text = "const ".to_owned(); let name = self.ident.to_string(); let defs = vec![SigElement { - id: id_from_hir_id(self.hir_id, scx), + id: id_from_def_id(self.def_id.to_def_id()), start: offset + text.len(), end: offset + text.len() + name.len(), }]; @@ -391,7 +391,7 @@ impl<'hir> Sig for hir::Item<'hir> { text.push_str("fn "); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; sig.text.push('('); for i in decl.inputs { @@ -420,7 +420,7 @@ impl<'hir> Sig for hir::Item<'hir> { let mut text = "mod ".to_owned(); let name = self.ident.to_string(); let defs = vec![SigElement { - id: id_from_hir_id(self.hir_id, scx), + id: id_from_def_id(self.def_id.to_def_id()), start: offset + text.len(), end: offset + text.len() + name.len(), }]; @@ -433,7 +433,7 @@ impl<'hir> Sig for hir::Item<'hir> { hir::ItemKind::TyAlias(ref ty, ref generics) => { let text = "type ".to_owned(); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; sig.text.push_str(" = "); let ty = ty.make(offset + sig.text.len(), id, scx)?; @@ -445,21 +445,21 @@ impl<'hir> Sig for hir::Item<'hir> { hir::ItemKind::Enum(_, ref generics) => { let text = "enum ".to_owned(); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; sig.text.push_str(" {}"); Ok(sig) } hir::ItemKind::Struct(_, ref generics) => { let text = "struct ".to_owned(); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; sig.text.push_str(" {}"); Ok(sig) } hir::ItemKind::Union(_, ref generics) => { let text = "union ".to_owned(); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; sig.text.push_str(" {}"); Ok(sig) } @@ -475,7 +475,7 @@ impl<'hir> Sig for hir::Item<'hir> { } text.push_str("trait "); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; if !bounds.is_empty() { sig.text.push_str(": "); @@ -490,7 +490,7 @@ impl<'hir> Sig for hir::Item<'hir> { let mut text = String::new(); text.push_str("trait "); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; if !bounds.is_empty() { sig.text.push_str(" = "); @@ -736,14 +736,14 @@ impl<'hir> Sig for hir::Variant<'hir> { impl<'hir> Sig for hir::ForeignItem<'hir> { fn make(&self, offset: usize, _parent_id: Option<hir::HirId>, scx: &SaveContext<'_>) -> Result { - let id = Some(self.hir_id); + let id = Some(self.hir_id()); match self.kind { hir::ForeignItemKind::Fn(decl, _, ref generics) => { let mut text = String::new(); text.push_str("fn "); let mut sig = - name_and_generics(text, offset, generics, self.hir_id, self.ident, scx)?; + name_and_generics(text, offset, generics, self.hir_id(), self.ident, scx)?; sig.text.push('('); for i in decl.inputs { @@ -774,7 +774,7 @@ impl<'hir> Sig for hir::ForeignItem<'hir> { } let name = self.ident.to_string(); let defs = vec![SigElement { - id: id_from_hir_id(self.hir_id, scx), + id: id_from_def_id(self.def_id.to_def_id()), start: offset + text.len(), end: offset + text.len() + name.len(), }]; @@ -790,7 +790,7 @@ impl<'hir> Sig for hir::ForeignItem<'hir> { let mut text = "type ".to_owned(); let name = self.ident.to_string(); let defs = vec![SigElement { - id: id_from_hir_id(self.hir_id, scx), + id: id_from_def_id(self.def_id.to_def_id()), start: offset + text.len(), end: offset + text.len() + name.len(), }]; |
