aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammad Mahad <mahadtxt@gmail.com>2023-06-20 20:19:13 +0500
committerPhilip Herron <philip.herron@embecosm.com>2023-06-27 09:27:22 +0000
commitf56fd7edc14f9d4906f20efacf093bc7c12a8361 (patch)
treea0036e6b5e293da2cf28da8f8f226c9879fe8b11
parent96ba341e0fd4799bcd22535fc2166a9ac96628ca (diff)
downloadgcc-f56fd7edc14f9d4906f20efacf093bc7c12a8361.zip
gcc-f56fd7edc14f9d4906f20efacf093bc7c12a8361.tar.gz
gcc-f56fd7edc14f9d4906f20efacf093bc7c12a8361.tar.bz2
gccrs:[E0026] Non-Existent Field Extraction in Struct Pattern
Non-Existent Field Extraction in Struct Pattern variant `Foo::D` does not have a field named `b` gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): called rust_error_at Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-pattern.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index bdd9095..4d9d5ba 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -204,7 +204,7 @@ TypeCheckPattern::visit (HIR::StructPattern &pattern)
if (!variant->lookup_field (ident.get_identifier (), &field,
nullptr))
{
- rust_error_at (ident.get_locus (),
+ rust_error_at (ident.get_locus (), ErrorCode ("E0026"),
"variant %s does not have a field named %s",
variant->get_identifier ().c_str (),
ident.get_identifier ().c_str ());
@@ -225,7 +225,7 @@ TypeCheckPattern::visit (HIR::StructPattern &pattern)
if (!variant->lookup_field (ident.get_identifier (), &field,
nullptr))
{
- rust_error_at (ident.get_locus (),
+ rust_error_at (ident.get_locus (), ErrorCode ("E0026"),
"variant %s does not have a field named %s",
variant->get_identifier ().c_str (),
ident.get_identifier ().c_str ());