Test macros

This commit is contained in:
Oli Scherer 2023-01-31 12:28:21 +00:00
parent 1d6cd8daf0
commit 6b24a9cf70
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,10 @@
error: `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
--> $DIR/macros.rs:10:12
|
LL | ($t:ty is $p:pat) => {};
| ^^ not allowed after `ty` fragments
|
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: aborting due to 1 previous error

View File

@ -0,0 +1,10 @@
error: `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
--> $DIR/macros.rs:10:12
|
LL | ($t:ty is $p:pat) => {};
| ^^ not allowed after `ty` fragments
|
= note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
error: aborting due to 1 previous error

View File

@ -0,0 +1,15 @@
//@ revisions: gated active
#![cfg_attr(active, feature(pattern_types))]
#![allow(incomplete_features)]
// Check that pattern types do not affect existing macros.
// They don't, because `is` was never legal after `ty` fragments.
macro_rules! foo {
($t:ty is $p:pat) => {}; //~ ERROR `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
}
fn main() {
foo!(u32 is 1..)
}