gccrs: Fix test same_field_name.rs

gcc/rust/ChangeLog:

	* hir/rust-ast-lower-item.cc
	(ASTLoweringItem::visit): Keep going after a duplicate field is
	found.

gcc/testsuite/ChangeLog:

	* rust/execute/same_field_name.rs: Move to...
	* rust/compile/same_field_name.rs: ...here and adjust expected
	errors.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
This commit is contained in:
Owen Avery
2025-05-09 20:48:18 -04:00
committed by Arthur Cohen
parent f79beeae1f
commit 8e454ab6e1
2 changed files with 2 additions and 2 deletions

View File

@@ -217,7 +217,7 @@ ASTLoweringItem::visit (AST::StructStruct &struct_decl)
field.get_outer_attrs ());
if (struct_field_name_exists (fields, translated_field))
break;
continue;
fields.push_back (std::move (translated_field));
}

View File

@@ -1,7 +1,7 @@
// https://doc.rust-lang.org/error_codes/E0124.html
fn main() {
struct Foo {
field1: i32, // { dg-error "field .field1. is already declared" }
field1: i32,
field1: i32, // { dg-error "field .field1. is already declared" }
field1: i32, // { dg-error "field .field1. is already declared" }
}