Use ItemId as a strongly typed index.

This commit is contained in:
Camille GILLOT 2021-01-30 12:06:04 +01:00
parent ac8961fc04
commit c676e358a5
28 changed files with 63 additions and 51 deletions

View file

@ -1382,7 +1382,7 @@ impl<'tcx> Visitor<'tcx> for DumpVisitor<'tcx> {
});
}
hir::TyKind::OpaqueDef(item_id, _) => {
let item = self.tcx.hir().item(item_id.id);
let item = self.tcx.hir().item(item_id);
self.nest_typeck_results(self.tcx.hir().local_def_id(item_id.id), |v| {
v.visit_item(item)
});

View file

@ -317,7 +317,7 @@ 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);
let item = scx.tcx.hir().item(item_id);
item.make(offset, Some(item_id.id), scx)
}
hir::TyKind::Typeof(_) | hir::TyKind::Infer | hir::TyKind::Err => Err("Ty"),