_ => return,
};
- let def_id = self.tcx.hir().local_def_id(item.hir_id);
- let self_ty = self.tcx.type_of(def_id);
+ let self_ty = self.tcx.type_of(item.def_id);
let lang_items = self.tcx.lang_items();
match *self_ty.kind() {
ty::Adt(def, _) => {
}
ty::Bool => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.bool_impl(),
None,
"bool",
}
ty::Char => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.char_impl(),
None,
"char",
}
ty::Str => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.str_impl(),
lang_items.str_alloc_impl(),
"str",
}
ty::Slice(slice_item) if slice_item == self.tcx.types.u8 => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.slice_u8_impl(),
lang_items.slice_u8_alloc_impl(),
"slice_u8",
}
ty::Slice(_) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.slice_impl(),
lang_items.slice_alloc_impl(),
"slice",
}
ty::Array(_, _) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.array_impl(),
None,
"array",
if matches!(inner.kind(), ty::Slice(_)) =>
{
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.const_slice_ptr_impl(),
None,
"const_slice_ptr",
if matches!(inner.kind(), ty::Slice(_)) =>
{
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.mut_slice_ptr_impl(),
None,
"mut_slice_ptr",
}
ty::RawPtr(ty::TypeAndMut { ty: _, mutbl: hir::Mutability::Not }) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.const_ptr_impl(),
None,
"const_ptr",
}
ty::RawPtr(ty::TypeAndMut { ty: _, mutbl: hir::Mutability::Mut }) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.mut_ptr_impl(),
None,
"mut_ptr",
}
ty::Int(ty::IntTy::I8) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.i8_impl(),
None,
"i8",
}
ty::Int(ty::IntTy::I16) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.i16_impl(),
None,
"i16",
}
ty::Int(ty::IntTy::I32) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.i32_impl(),
None,
"i32",
}
ty::Int(ty::IntTy::I64) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.i64_impl(),
None,
"i64",
}
ty::Int(ty::IntTy::I128) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.i128_impl(),
None,
"i128",
}
ty::Int(ty::IntTy::Isize) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.isize_impl(),
None,
"isize",
}
ty::Uint(ty::UintTy::U8) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.u8_impl(),
None,
"u8",
}
ty::Uint(ty::UintTy::U16) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.u16_impl(),
None,
"u16",
}
ty::Uint(ty::UintTy::U32) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.u32_impl(),
None,
"u32",
}
ty::Uint(ty::UintTy::U64) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.u64_impl(),
None,
"u64",
}
ty::Uint(ty::UintTy::U128) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.u128_impl(),
None,
"u128",
}
ty::Uint(ty::UintTy::Usize) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.usize_impl(),
None,
"usize",
}
ty::Float(ty::FloatTy::F32) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.f32_impl(),
lang_items.f32_runtime_impl(),
"f32",
}
ty::Float(ty::FloatTy::F64) => {
self.check_primitive_impl(
- def_id,
+ item.def_id,
lang_items.f64_impl(),
lang_items.f64_runtime_impl(),
"f64",
// Add the implementation to the mapping from implementation to base
// type def ID, if there is a base type for this implementation and
// the implementation does not have any associated traits.
- let impl_def_id = self.tcx.hir().local_def_id(item.hir_id);
let vec = self.impls_map.inherent_impls.entry(def_id).or_default();
- vec.push(impl_def_id.to_def_id());
+ vec.push(item.def_id.to_def_id());
} else {
struct_span_err!(
self.tcx.sess,