diff options
| author | Muhammad Mahad <mahadtxt@gmail.com> | 2023-07-10 17:26:45 +0500 |
|---|---|---|
| committer | Philip Herron <philip.herron@embecosm.com> | 2023-07-11 10:26:26 +0000 |
| commit | 1827610473eb11d489bcb6c6aae9417c002ee7be (patch) | |
| tree | ac119350f45bfaebea80e6fc73b333bb02b29364 /gcc/rust | |
| parent | 5d124d1512f93aec076a696daf15dcc646186383 (diff) | |
| download | gcc-1827610473eb11d489bcb6c6aae9417c002ee7be.zip gcc-1827610473eb11d489bcb6c6aae9417c002ee7be.tar.gz gcc-1827610473eb11d489bcb6c6aae9417c002ee7be.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/rust')
| -rw-r--r-- | gcc/rust/hir/rust-ast-lower-base.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index 23a3ec4..bdf5bb1 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -681,7 +681,8 @@ struct_field_name_exists (std::vector<HIR::StructField> &fields, { RichLocation r (new_field.get_locus ()); r.add_range (field.get_locus ()); - rust_error_at (r, "duplicate field name %qs", + rust_error_at (r, ErrorCode ("E0124"), + "field %qs is already declared", field.get_field_name ().as_string ().c_str ()); return true; } |
