Skip to content

Commit 6b24a9c

Browse files
committed
Test macros
1 parent 1d6cd8d commit 6b24a9c

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
2+
--> $DIR/macros.rs:10:12
3+
|
4+
LL | ($t:ty is $p:pat) => {};
5+
| ^^ not allowed after `ty` fragments
6+
|
7+
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
8+
9+
error: aborting due to 1 previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
2+
--> $DIR/macros.rs:10:12
3+
|
4+
LL | ($t:ty is $p:pat) => {};
5+
| ^^ not allowed after `ty` fragments
6+
|
7+
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
8+
9+
error: aborting due to 1 previous error
10+

tests/ui/type/pattern_types/macros.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ revisions: gated active
2+
3+
#![cfg_attr(active, feature(pattern_types))]
4+
#![allow(incomplete_features)]
5+
6+
// Check that pattern types do not affect existing macros.
7+
// They don't, because `is` was never legal after `ty` fragments.
8+
9+
macro_rules! foo {
10+
($t:ty is $p:pat) => {}; //~ ERROR `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
11+
}
12+
13+
fn main() {
14+
foo!(u32 is 1..)
15+
}

0 commit comments

Comments
 (0)