mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 13:05:18 +03:00
Use ItemId as a strongly typed index.
This commit is contained in:
@@ -375,7 +375,7 @@ fn visit_ty(&mut self, ty: &'tcx Ty<'_>) {
|
||||
match ty.kind {
|
||||
TyKind::OpaqueDef(item, _) => {
|
||||
let map = self.cx.tcx.hir();
|
||||
let item = map.expect_item(item.id);
|
||||
let item = map.item(item);
|
||||
walk_item(self, item);
|
||||
walk_ty(self, ty);
|
||||
},
|
||||
|
||||
@@ -102,7 +102,7 @@ fn future_trait_ref<'tcx>(
|
||||
) -> Option<(&'tcx TraitRef<'tcx>, Vec<LifetimeName>)> {
|
||||
if_chain! {
|
||||
if let TyKind::OpaqueDef(item_id, bounds) = ty.kind;
|
||||
let item = cx.tcx.hir().item(item_id.id);
|
||||
let item = cx.tcx.hir().item(item_id);
|
||||
if let ItemKind::OpaqueTy(opaque) = &item.kind;
|
||||
if let Some(trait_ref) = opaque.bounds.iter().find_map(|bound| {
|
||||
if let GenericBound::Trait(poly, _) = bound {
|
||||
|
||||
@@ -107,7 +107,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, it: &'tcx hir::Item<'_>) {
|
||||
// trait method with default body needs inline in case
|
||||
// an impl is not provided
|
||||
let desc = "a default trait method";
|
||||
let item = cx.tcx.hir().expect_trait_item(tit.id.hir_id);
|
||||
let item = cx.tcx.hir().trait_item(tit.id);
|
||||
check_missing_inline_attrs(cx, &item.attrs, item.span, desc);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -130,7 +130,7 @@ fn check_arm(&mut self, cx: &LateContext<'tcx>, arm: &'tcx hir::Arm<'_>) {
|
||||
}
|
||||
|
||||
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id.id))) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
|
||||
return;
|
||||
}
|
||||
prelude();
|
||||
|
||||
@@ -109,7 +109,7 @@ fn check_arm(&mut self, cx: &LateContext<'tcx>, arm: &'tcx hir::Arm<'_>) {
|
||||
}
|
||||
|
||||
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id.id))) {
|
||||
if !has_attr(cx.sess(), stmt.kind.attrs(|id| cx.tcx.hir().item(id))) {
|
||||
return;
|
||||
}
|
||||
match stmt.kind {
|
||||
|
||||
Reference in New Issue
Block a user