Only store a LocalDefId in hir::ForeignItem.
This commit is contained in:
parent
786a80e9ea
commit
996dc8d5c5
32 changed files with 133 additions and 110 deletions
|
@ -1449,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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(),
|
||||
}];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue