aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/dup_fields.rs
diff options
context:
space:
mode:
authorMuhammad Mahad <mahadtxt@gmail.com>2023-07-10 17:26:45 +0500
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:49:35 +0100
commit9c99d52d00a941f48d93ae116cd425440bdfa5b2 (patch)
tree0bdb80451e7435514646f9a613e6b11bf808a7c1 /gcc/testsuite/rust/compile/dup_fields.rs
parentf9b0ca04c88bcea93d9e80f2c98089da7484f0d7 (diff)
downloadgcc-9c99d52d00a941f48d93ae116cd425440bdfa5b2.zip
gcc-9c99d52d00a941f48d93ae116cd425440bdfa5b2.tar.gz
gcc-9c99d52d00a941f48d93ae116cd425440bdfa5b2.tar.bz2
gccrs: [E0124] field x is already declared in struct
Refactored error message for more than one duplicate fields. gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (struct_field_name_exists): called error function. gcc/testsuite/ChangeLog: * rust/compile/bad_pub_enumitems.rs: changed comment to pass test cases. * rust/compile/dup_fields.rs: likewise. * rust/execute/same_field_name.rs: New test. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Diffstat (limited to 'gcc/testsuite/rust/compile/dup_fields.rs')
-rw-r--r--gcc/testsuite/rust/compile/dup_fields.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/testsuite/rust/compile/dup_fields.rs b/gcc/testsuite/rust/compile/dup_fields.rs
index ab39955..67003db 100644
--- a/gcc/testsuite/rust/compile/dup_fields.rs
+++ b/gcc/testsuite/rust/compile/dup_fields.rs
@@ -1,23 +1,23 @@
struct S { a: i32, b: i32, c: u8, a: i128 }
-// { dg-error "duplicate field" "" { target *-*-* } .-1 }
+// { dg-error "field .a. is already declared" "" { target *-*-* } .-1 }
union U
{
a: i32,
b: i32,
c: u8,
- b: char // { dg-error "duplicate field" "" { target *-*-* } }
+ b: char // { dg-error "field .b. is already declared" "" { target *-*-* } }
}
fn main ()
{
struct SS { alpha: i32, beta: i32, gamma: u8, gamma: i128 }
- // { dg-error "duplicate field" "" { target *-*-* } .-1 }
+ // { dg-error "field .gamma. is already declared" "" { target *-*-* } .-1 }
union UU
{
alpha: i32, beta: i32,
gamma: u8, beta: char
- // { dg-error "duplicate field" "" { target *-*-* } .-1 }
+ // { dg-error "field .beta. is already declared" "" { target *-*-* } .-1 }
}
}