Skip to content

Commit 5b5fe17

Browse files
Villossephilberty
authored andcommitted
gccrs: adds tests from issue 4140
Adds tests for testsuite. Fixes #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>
1 parent fb0a7a1 commit 5b5fe17

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pub enum TypeCtor {
2+
Slice,
3+
Array,
4+
}
5+
pub struct B<T>(T);
6+
7+
macro_rules! ty_app {
8+
($_a:pat) => {
9+
ApplicationTy($ctor) // { dg-error "unexpected token '$' in typle struct items" "4140" { target *-*-* } . }
10+
// { dg-error "failed to parse typle struct items" "4140" { target *-*-*} .-1 }
11+
};
12+
}
13+
14+
pub fn foo(ty: ApplicationTy) { // { dg-error "could not resolve type path 'ApplicationTy'" "4140" { target *-*-* } .-1 }
15+
match ty {
16+
ty_app!(bean::Array) => {}
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
macro_rules! ty_app {
2+
($_a:pat) => {
3+
($ctor) // { dg-error "unrecognised token '$' in grouped or tuple pattern after first pattern" "4140" { target *-*-* } . }
4+
};
5+
}
6+
7+
pub fn foo() {
8+
match ty { // { dg-error "Cannot find path 'ty' in this scope" "4140" { target *-*-* } .-1 }
9+
ty_app!(bean::Array) => {}
10+
}
11+
}

0 commit comments

Comments
 (0)