From: Owen Avery <powerboat9.ga...@gmail.com>

gcc/rust/ChangeLog:

        * resolve/rust-ast-resolve-expr.cc
        (ResolveExpr::visit): Modify error message.
        * resolve/rust-ast-resolve-implitem.h
        (ResolveToplevelImplItem::visit): Likewise.
        (ResolveTopLevelTraitItems::visit): Likewise.
        (ResolveToplevelExternItem::visit): Likewise.
        * resolve/rust-ast-resolve-stmt.cc
        (ResolveStmt::visit): Likewise.
        * resolve/rust-ast-resolve-stmt.h
        (ResolveStmt::visit): Likewise.
        * resolve/rust-ast-resolve-toplevel.h
        (ResolveTopLevel::visit): Likewise.
        * resolve/rust-ast-resolve-type.h
        (ResolveGenericParams::visit): Likewise.

gcc/testsuite/ChangeLog:

        * rust/compile/nr2/exclude: Remove entries.
        * rust/compile/redef_error2.rs: Modify expected error.
        * rust/compile/redef_error5.rs: Likewise.

Signed-off-by: Owen Avery <powerboat9.ga...@gmail.com>
---
 gcc/rust/resolve/rust-ast-resolve-expr.cc    |  8 ++---
 gcc/rust/resolve/rust-ast-resolve-implitem.h | 18 +++++------
 gcc/rust/resolve/rust-ast-resolve-stmt.cc    |  2 +-
 gcc/rust/resolve/rust-ast-resolve-stmt.h     | 20 ++++++------
 gcc/rust/resolve/rust-ast-resolve-toplevel.h | 32 ++++++++++----------
 gcc/rust/resolve/rust-ast-resolve-type.h     |  2 +-
 gcc/testsuite/rust/compile/nr2/exclude       |  2 --
 gcc/testsuite/rust/compile/redef_error2.rs   |  2 +-
 gcc/testsuite/rust/compile/redef_error5.rs   |  2 +-
 9 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc 
b/gcc/rust/resolve/rust-ast-resolve-expr.cc
index be960beccd5..dc7f76d652d 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc
@@ -287,7 +287,7 @@ ResolveExpr::visit (AST::BlockExpr &expr)
        CanonicalPath::new_seg (label.get_node_id (), label_name),
        label_lifetime_node_id, label.get_locus (), false, Rib::ItemType::Label,
        [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
-         rust_error_at (label.get_locus (), "label redefined multiple times");
+         rust_error_at (label.get_locus (), "label defined multiple times");
          rust_error_at (locus, "was defined here");
        });
     }
@@ -459,7 +459,7 @@ ResolveExpr::visit (AST::LoopExpr &expr)
        CanonicalPath::new_seg (expr.get_node_id (), label_name),
        label_lifetime_node_id, label.get_locus (), false, Rib::ItemType::Label,
        [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
-         rust_error_at (label.get_locus (), "label redefined multiple times");
+         rust_error_at (label.get_locus (), "label defined multiple times");
          rust_error_at (locus, "was defined here");
        });
     }
@@ -535,7 +535,7 @@ ResolveExpr::visit (AST::WhileLoopExpr &expr)
        CanonicalPath::new_seg (label.get_node_id (), label_name),
        label_lifetime_node_id, label.get_locus (), false, Rib::ItemType::Label,
        [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
-         rust_error_at (label.get_locus (), "label redefined multiple times");
+         rust_error_at (label.get_locus (), "label defined multiple times");
          rust_error_at (locus, "was defined here");
        });
     }
@@ -564,7 +564,7 @@ ResolveExpr::visit (AST::ForLoopExpr &expr)
        CanonicalPath::new_seg (label.get_node_id (), label_name),
        label_lifetime_node_id, label.get_locus (), false, Rib::ItemType::Label,
        [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
-         rust_error_at (label.get_locus (), "label redefined multiple times");
+         rust_error_at (label.get_locus (), "label defined multiple times");
          rust_error_at (locus, "was defined here");
        });
     }
diff --git a/gcc/rust/resolve/rust-ast-resolve-implitem.h 
b/gcc/rust/resolve/rust-ast-resolve-implitem.h
index 2ca12965d9b..971bf8faee2 100644
--- a/gcc/rust/resolve/rust-ast-resolve-implitem.h
+++ b/gcc/rust/resolve/rust-ast-resolve-implitem.h
@@ -51,7 +51,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, type.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
   }
 
@@ -67,7 +67,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, constant.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
   }
 
@@ -84,7 +84,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, function.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
   }
 
@@ -124,7 +124,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, function.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     mappings.insert_canonical_path (function.get_node_id (), cpath);
@@ -144,7 +144,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, constant.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     mappings.insert_canonical_path (constant.get_node_id (), cpath);
@@ -162,7 +162,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, type.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     mappings.insert_canonical_path (type.get_node_id (), cpath);
@@ -202,7 +202,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, function.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -221,7 +221,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -240,7 +240,7 @@ public:
        rich_location r (line_table, type.get_locus ());
        r.add_range (locus);
 
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
diff --git a/gcc/rust/resolve/rust-ast-resolve-stmt.cc 
b/gcc/rust/resolve/rust-ast-resolve-stmt.cc
index 226d8e8e2f4..fefb522aec7 100644
--- a/gcc/rust/resolve/rust-ast-resolve-stmt.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-stmt.cc
@@ -70,7 +70,7 @@ ResolveStmt::visit (AST::StaticItem &var)
     [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
       rich_location r (line_table, var.get_locus ());
       r.add_range (locus);
-      rust_error_at (r, "redefined multiple times");
+      rust_error_at (r, "defined multiple times");
     });
 
   ResolveType::go (var.get_type ());
diff --git a/gcc/rust/resolve/rust-ast-resolve-stmt.h 
b/gcc/rust/resolve/rust-ast-resolve-stmt.h
index 5b425e84106..d3ff14f755e 100644
--- a/gcc/rust/resolve/rust-ast-resolve-stmt.h
+++ b/gcc/rust/resolve/rust-ast-resolve-stmt.h
@@ -63,7 +63,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, constant.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     ResolveType::go (constant.get_type ());
@@ -97,7 +97,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, struct_decl.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId scope_node_id = struct_decl.get_node_id ();
@@ -128,7 +128,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, enum_decl.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId scope_node_id = enum_decl.get_node_id ();
@@ -158,7 +158,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     // Done, no fields.
@@ -178,7 +178,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     for (auto &field : item.get_tuple_fields ())
@@ -204,7 +204,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     for (auto &field : item.get_struct_fields ())
@@ -230,7 +230,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     // Done, no fields.
@@ -251,7 +251,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, struct_decl.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId scope_node_id = struct_decl.get_node_id ();
@@ -287,7 +287,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, union_decl.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId scope_node_id = union_decl.get_node_id ();
@@ -323,7 +323,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, function.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId scope_node_id = function.get_node_id ();
diff --git a/gcc/rust/resolve/rust-ast-resolve-toplevel.h 
b/gcc/rust/resolve/rust-ast-resolve-toplevel.h
index 6828e573618..379ccabae25 100644
--- a/gcc/rust/resolve/rust-ast-resolve-toplevel.h
+++ b/gcc/rust/resolve/rust-ast-resolve-toplevel.h
@@ -58,7 +58,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, module.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -88,7 +88,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, alias.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -110,7 +110,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, struct_decl.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -132,7 +132,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, enum_decl.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     resolver->push_new_module_scope (enum_decl.get_node_id ());
@@ -158,7 +158,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     mappings.insert_canonical_path (item.get_node_id (), cpath);
@@ -180,7 +180,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     mappings.insert_canonical_path (item.get_node_id (), cpath);
@@ -202,7 +202,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     mappings.insert_canonical_path (item.get_node_id (), cpath);
@@ -224,7 +224,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, item.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     mappings.insert_canonical_path (item.get_node_id (), cpath);
@@ -246,7 +246,7 @@ public:
       = [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
       rich_location r (line_table, struct_decl.get_locus ());
       r.add_range (locus);
-      rust_error_at (r, "redefined multiple times");
+      rust_error_at (r, "defined multiple times");
     };
 
     resolver->get_type_scope ().insert (path, struct_decl.get_node_id (),
@@ -277,7 +277,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, union_decl.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -297,7 +297,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, var.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -318,7 +318,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, constant.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -340,7 +340,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, function.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     NodeId current_module = resolver->peek_current_module_scope ();
@@ -388,7 +388,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, impl_block.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     for (auto &impl_item : impl_block.get_impl_items ())
@@ -408,7 +408,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, trait.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
 
     for (auto &item : trait.get_trait_items ())
@@ -480,7 +480,7 @@ public:
       [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
        rich_location r (line_table, extern_crate.get_locus ());
        r.add_range (locus);
-       rust_error_at (r, "redefined multiple times");
+       rust_error_at (r, "defined multiple times");
       });
   }
 
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.h 
b/gcc/rust/resolve/rust-ast-resolve-type.h
index 7edcec9e1f6..8379d0e9f84 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.h
+++ b/gcc/rust/resolve/rust-ast-resolve-type.h
@@ -160,7 +160,7 @@ public:
          Rib::ItemType::Type,
          [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
            rust_error_at (param.get_locus (),
-                          "generic param redefined multiple times");
+                          "generic param defined multiple times");
            rust_error_at (locus, "was defined here");
          });
 
diff --git a/gcc/testsuite/rust/compile/nr2/exclude 
b/gcc/testsuite/rust/compile/nr2/exclude
index 6b8cf9801c5..de5824813b4 100644
--- a/gcc/testsuite/rust/compile/nr2/exclude
+++ b/gcc/testsuite/rust/compile/nr2/exclude
@@ -25,8 +25,6 @@ privacy8.rs
 pub_restricted_1.rs
 pub_restricted_2.rs
 pub_restricted_3.rs
-redef_error2.rs
-redef_error5.rs
 sizeof-stray-infer-var-bug.rs
 struct-expr-parse.rs
 undeclared_label.rs
diff --git a/gcc/testsuite/rust/compile/redef_error2.rs 
b/gcc/testsuite/rust/compile/redef_error2.rs
index 65793bcda8a..ed946f8b810 100644
--- a/gcc/testsuite/rust/compile/redef_error2.rs
+++ b/gcc/testsuite/rust/compile/redef_error2.rs
@@ -1,4 +1,4 @@
 const TEST: i32 = 2;
-const TEST: f32 = 3.0; // { dg-error "redefined multiple times" }
+const TEST: f32 = 3.0; // { dg-error "defined multiple times" }
 
 fn main() {}
diff --git a/gcc/testsuite/rust/compile/redef_error5.rs 
b/gcc/testsuite/rust/compile/redef_error5.rs
index dc6ad50e104..b3d71e17d94 100644
--- a/gcc/testsuite/rust/compile/redef_error5.rs
+++ b/gcc/testsuite/rust/compile/redef_error5.rs
@@ -2,7 +2,7 @@ struct Foo(i32, bool);
 
 impl Foo {
     const TEST: i32 = 123;
-    const TEST: bool = false; // { dg-error "redefined multiple times"  }
+    const TEST: bool = false; // { dg-error "defined multiple times"  }
 }
 
 fn main() {}
-- 
2.45.2

Reply via email to