Store a LocalDefId in hir::Variant & hir::Field.
This commit is contained in:
@@ -2137,7 +2137,7 @@ impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
fn visit_variant(&mut self, variant: &'tcx hir::Variant<'tcx>) {
|
||||
self.check_attributes(variant.id, variant.span, Target::Variant, None);
|
||||
self.check_attributes(variant.hir_id, variant.span, Target::Variant, None);
|
||||
intravisit::walk_variant(self, variant)
|
||||
}
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
|
||||
let has_repr_c = self.repr_has_repr_c;
|
||||
let has_repr_simd = self.repr_has_repr_simd;
|
||||
let live_fields = def.fields().iter().filter_map(|f| {
|
||||
let def_id = tcx.hir().local_def_id(f.hir_id);
|
||||
let def_id = f.def_id;
|
||||
if has_repr_c || (f.is_positional() && has_repr_simd) {
|
||||
return Some(def_id);
|
||||
}
|
||||
@@ -522,17 +522,13 @@ fn check_item<'tcx>(
|
||||
DefKind::Enum => {
|
||||
let item = tcx.hir().item(id);
|
||||
if let hir::ItemKind::Enum(ref enum_def, _) = item.kind {
|
||||
let hir = tcx.hir();
|
||||
if allow_dead_code {
|
||||
worklist.extend(
|
||||
enum_def.variants.iter().map(|variant| hir.local_def_id(variant.id)),
|
||||
);
|
||||
worklist.extend(enum_def.variants.iter().map(|variant| variant.def_id));
|
||||
}
|
||||
|
||||
for variant in enum_def.variants {
|
||||
if let Some(ctor_hir_id) = variant.data.ctor_hir_id() {
|
||||
struct_constructors
|
||||
.insert(hir.local_def_id(ctor_hir_id), hir.local_def_id(variant.id));
|
||||
if let Some(ctor_def_id) = variant.data.ctor_def_id() {
|
||||
struct_constructors.insert(ctor_def_id, variant.def_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ fn get_lang_items(tcx: TyCtxt<'_>, (): ()) -> LanguageItems {
|
||||
let item = tcx.hir().item(id);
|
||||
if let hir::ItemKind::Enum(def, ..) = &item.kind {
|
||||
for variant in def.variants {
|
||||
collector.check_for_lang(Target::Variant, variant.id);
|
||||
collector.check_for_lang(Target::Variant, variant.hir_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,9 +358,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||
const_stab_inherit = InheritConstStability::Yes;
|
||||
}
|
||||
hir::ItemKind::Struct(ref sd, _) => {
|
||||
if let Some(ctor_hir_id) = sd.ctor_hir_id() {
|
||||
if let Some(ctor_def_id) = sd.ctor_def_id() {
|
||||
self.annotate(
|
||||
self.tcx.hir().local_def_id(ctor_hir_id),
|
||||
ctor_def_id,
|
||||
i.span,
|
||||
None,
|
||||
AnnotationKind::Required,
|
||||
@@ -435,7 +435,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||
|
||||
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>) {
|
||||
self.annotate(
|
||||
self.tcx.hir().local_def_id(var.id),
|
||||
var.def_id,
|
||||
var.span,
|
||||
None,
|
||||
AnnotationKind::Required,
|
||||
@@ -443,9 +443,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||
InheritConstStability::No,
|
||||
InheritStability::Yes,
|
||||
|v| {
|
||||
if let Some(ctor_hir_id) = var.data.ctor_hir_id() {
|
||||
if let Some(ctor_def_id) = var.data.ctor_def_id() {
|
||||
v.annotate(
|
||||
v.tcx.hir().local_def_id(ctor_hir_id),
|
||||
ctor_def_id,
|
||||
var.span,
|
||||
None,
|
||||
AnnotationKind::Required,
|
||||
@@ -463,7 +463,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
|
||||
|
||||
fn visit_field_def(&mut self, s: &'tcx FieldDef<'tcx>) {
|
||||
self.annotate(
|
||||
self.tcx.hir().local_def_id(s.hir_id),
|
||||
s.def_id,
|
||||
s.span,
|
||||
None,
|
||||
AnnotationKind::Required,
|
||||
@@ -593,15 +593,15 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
|
||||
}
|
||||
|
||||
fn visit_variant(&mut self, var: &'tcx Variant<'tcx>) {
|
||||
self.check_missing_stability(self.tcx.hir().local_def_id(var.id), var.span);
|
||||
if let Some(ctor_hir_id) = var.data.ctor_hir_id() {
|
||||
self.check_missing_stability(self.tcx.hir().local_def_id(ctor_hir_id), var.span);
|
||||
self.check_missing_stability(var.def_id, var.span);
|
||||
if let Some(ctor_def_id) = var.data.ctor_def_id() {
|
||||
self.check_missing_stability(ctor_def_id, var.span);
|
||||
}
|
||||
intravisit::walk_variant(self, var);
|
||||
}
|
||||
|
||||
fn visit_field_def(&mut self, s: &'tcx FieldDef<'tcx>) {
|
||||
self.check_missing_stability(self.tcx.hir().local_def_id(s.hir_id), s.span);
|
||||
self.check_missing_stability(s.def_id, s.span);
|
||||
intravisit::walk_field_def(self, s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user