Store a Symbol instead of an Ident in VariantDef/FieldDef
The field is also renamed from `ident` to `name. In most cases, we don't actually need the `Span`. A new `ident` method is added to `VariantDef` and `FieldDef`, which constructs the full `Ident` using `tcx.def_ident_span()`. This method is used in the cases where we actually need an `Ident`. This makes incremental compilation properly track changes to the `Span`, without all of the invalidations caused by storing a `Span` directly via an `Ident`.
This commit is contained in:
@@ -903,7 +903,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
|
||||
let def_id = self.tcx.adjust_ident_and_get_scope(ident, def.did, hir_id).1;
|
||||
if !field.vis.is_accessible_from(def_id, self.tcx) {
|
||||
let label = if in_update_syntax {
|
||||
format!("field `{}` is private", field.ident)
|
||||
format!("field `{}` is private", field.name)
|
||||
} else {
|
||||
"private field".to_string()
|
||||
};
|
||||
@@ -913,7 +913,7 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
|
||||
span,
|
||||
E0451,
|
||||
"field `{}` of {} `{}` is private",
|
||||
field.ident,
|
||||
field.name,
|
||||
def.variant_descr(),
|
||||
self.tcx.def_path_str(def.did)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user