about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorFrank King <frankking1729@gmail.com>2024-01-29 15:08:11 +0800
committerFrank King <frankking1729@gmail.com>2024-02-12 12:47:32 +0800
commit0dbd6e9572c7c2bac7922116d6cd9357177ccbc9 (patch)
treea84d58196f2b7234c6deb6e8c675f9aba300507a /compiler/rustc_resolve/src
parent2b04ca94bb06c6913b8b14ba267b3d64b23e3c4d (diff)
downloadrust-0dbd6e9572c7c2bac7922116d6cd9357177ccbc9.tar.gz
rust-0dbd6e9572c7c2bac7922116d6cd9357177ccbc9.zip
Improve some codes according to the reviews
- improve diagnostics of field uniqueness check and representation check
- simplify the implementation of field uniqueness check
- remove some useless codes and improvement neatness
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/build_reduced_graph.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs
index 6bb9c22b04d..469d15e4214 100644
--- a/compiler/rustc_resolve/src/build_reduced_graph.rs
+++ b/compiler/rustc_resolve/src/build_reduced_graph.rs
@@ -628,7 +628,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
         }
     }
 
-    fn build_reduced_graph_for_fields(
+    fn build_reduced_graph_for_struct_variant(
         &mut self,
         fields: &[ast::FieldDef],
         ident: Ident,
@@ -657,14 +657,14 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
                     let def_id = local_def_id.to_def_id();
                     let def_kind = self.r.tcx.def_kind(local_def_id);
                     let res = Res::Def(def_kind, def_id);
-                    self.build_reduced_graph_for_fields(
+                    self.build_reduced_graph_for_struct_variant(
                         &nested_fields,
                         Ident::empty(),
                         local_def_id,
                         res,
                         // Anonymous adts inherit visibility from their parent adts.
                         adt_vis,
-                        field.span,
+                        field.ty.span,
                     );
                 }
                 _ => {}
@@ -759,7 +759,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
 
             // These items live in both the type and value namespaces.
             ItemKind::Struct(ref vdata, _) => {
-                self.build_reduced_graph_for_fields(
+                self.build_reduced_graph_for_struct_variant(
                     vdata.fields(),
                     ident,
                     local_def_id,
@@ -809,7 +809,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
             }
 
             ItemKind::Union(ref vdata, _) => {
-                self.build_reduced_graph_for_fields(
+                self.build_reduced_graph_for_struct_variant(
                     vdata.fields(),
                     ident,
                     local_def_id,