public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-7967] gccrs: [E0532] Pattern arm did not match expected kind
Date: Tue, 16 Jan 2024 18:09:32 +0000 (GMT)	[thread overview]
Message-ID: <20240116180932.C14E838582A3@sourceware.org> (raw)

https://gcc.gnu.org/g:5372086cf5243fa52c09bed8db49fe12918ab746

commit r14-7967-g5372086cf5243fa52c09bed8db49fe12918ab746
Author: Muhammad Mahad <mahadtxt@gmail.com>
Date:   Sat Sep 2 15:18:20 2023 +0500

    gccrs: [E0532] Pattern arm did not match expected kind
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
            Added error code.
    
    gcc/testsuite/ChangeLog:
    
            * rust/compile/issue-2029.rs:
            Updated for dejagnu testcase.
    
    Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 7 ++++---
 gcc/testsuite/rust/compile/issue-2029.rs          | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index 8e9dd556a3c..9a74e159f1b 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -53,9 +53,10 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
   TyTy::BaseType *pattern_ty = TypeCheckExpr::Resolve (&pattern.get_path ());
   if (pattern_ty->get_kind () != TyTy::TypeKind::ADT)
     {
-      rust_error_at (pattern.get_locus (),
-		     "expected tuple struct/variant, found: %s",
-		     pattern_ty->get_name ().c_str ());
+      rust_error_at (
+	pattern.get_locus (), ErrorCode::E0532,
+	"expected tuple struct or tuple variant, found function %qs",
+	pattern_ty->get_name ().c_str ());
       return;
     }
 
diff --git a/gcc/testsuite/rust/compile/issue-2029.rs b/gcc/testsuite/rust/compile/issue-2029.rs
index 78569631eb1..dab200d7d8e 100644
--- a/gcc/testsuite/rust/compile/issue-2029.rs
+++ b/gcc/testsuite/rust/compile/issue-2029.rs
@@ -6,7 +6,7 @@ fn foo(_: usize) -> Foo {
 fn main() {
     match Foo(true) {
         foo(x)
-        // { dg-error "expected tuple struct/variant, found" "" { target *-*-* } .-1 }
+        // { dg-error "expected tuple struct or tuple variant, found function " "" { target *-*-* } .-1 }
         => ()
     }
 }

                 reply	other threads:[~2024-01-16 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116180932.C14E838582A3@sourceware.org \
    --to=cohenarthur@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).