From: lenny.chiadmi-delage Date: Mon, 10 Nov 2025 16:00:29 +0000 (+0000) Subject: gccrs: adds tests from issue 4140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c12f9f19a7356fb88293ee95c432c48786b4b2f9;p=thirdparty%2Fgcc.git gccrs: adds tests from issue 4140 Adds tests for testsuite. Fixes Rust-GCC#4140 gcc/testsuite/ChangeLog: * rust/compile/issue-4140-1.rs: New test. * rust/compile/issue-4140-2.rs: Likewise. Signed-off-by: lenny.chiadmi-delage --- diff --git a/gcc/testsuite/rust/compile/issue-4140-1.rs b/gcc/testsuite/rust/compile/issue-4140-1.rs new file mode 100644 index 00000000000..48aa98bc318 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-4140-1.rs @@ -0,0 +1,18 @@ +pub enum TypeCtor { + Slice, + Array, +} +pub struct B(T); + +macro_rules! ty_app { + ($_a:pat) => { + ApplicationTy($ctor) // { dg-error "unexpected token '$' in typle struct items" "4140" { target *-*-* } . } + // { dg-error "failed to parse typle struct items" "4140" { target *-*-*} .-1 } + }; +} + +pub fn foo(ty: ApplicationTy) { // { dg-error "could not resolve type path 'ApplicationTy'" "4140" { target *-*-* } .-1 } + match ty { + ty_app!(bean::Array) => {} + } +} diff --git a/gcc/testsuite/rust/compile/issue-4140-2.rs b/gcc/testsuite/rust/compile/issue-4140-2.rs new file mode 100644 index 00000000000..507cf2aba38 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-4140-2.rs @@ -0,0 +1,11 @@ +macro_rules! ty_app { + ($_a:pat) => { + ($ctor) // { dg-error "unrecognised token '$' in grouped or tuple pattern after first pattern" "4140" { target *-*-* } . } + }; +} + +pub fn foo() { + match ty { // { dg-error "Cannot find path 'ty' in this scope" "4140" { target *-*-* } .-1 } + ty_app!(bean::Array) => {} + } +}