Skip to content

Commit 699f525

Browse files
MahadMuhammadphilberty
authored andcommitted
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>
1 parent 1f2dc64 commit 699f525

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

gcc/rust/typecheck/rust-hir-type-check-pattern.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
5353
TyTy::BaseType *pattern_ty = TypeCheckExpr::Resolve (&pattern.get_path ());
5454
if (pattern_ty->get_kind () != TyTy::TypeKind::ADT)
5555
{
56-
rust_error_at (pattern.get_locus (),
57-
"expected tuple struct/variant, found: %s",
58-
pattern_ty->get_name ().c_str ());
56+
rust_error_at (
57+
pattern.get_locus (), ErrorCode::E0532,
58+
"expected tuple struct or tuple variant, found function %qs",
59+
pattern_ty->get_name ().c_str ());
5960
return;
6061
}
6162

gcc/testsuite/rust/compile/issue-2029.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn foo(_: usize) -> Foo {
66
fn main() {
77
match Foo(true) {
88
foo(x)
9-
// { dg-error "expected tuple struct/variant, found" "" { target *-*-* } .-1 }
9+
// { dg-error "expected tuple struct or tuple variant, found function " "" { target *-*-* } .-1 }
1010
=> ()
1111
}
1212
}

0 commit comments

Comments
 (0)