Skip to content

Commit

Permalink
Test macros
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 22, 2024
1 parent 5865e14 commit 15d0a59
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/ui/type/pattern_types/macros.active.stderr
Original file line number Diff line number Diff line change
@@ -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

10 changes: 10 additions & 0 deletions tests/ui/type/pattern_types/macros.gated.stderr
Original file line number Diff line number Diff line change
@@ -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

15 changes: 15 additions & 0 deletions tests/ui/type/pattern_types/macros.rs
Original file line number Diff line number Diff line change
@@ -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..)
}

0 comments on commit 15d0a59

Please sign in to comment.