From 699f5257192ce8d9a856f4ee2779887aae6e92e9 Mon Sep 17 00:00:00 2001 From: Muhammad Mahad Date: Sat, 2 Sep 2023 15:18:20 +0500 Subject: 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 --- 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(-) (limited to 'gcc') diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc index fd9cfd2..ea744a6 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 7856963..dab200d 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 } => () } } -- cgit v1.1