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 <lenny.chiadmi-delage@epita.fr>
--- /dev/null
+pub enum TypeCtor {
+ Slice,
+ Array,
+}
+pub struct B<T>(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) => {}
+ }
+}
--- /dev/null
+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) => {}
+ }
+}