Test macros
This commit is contained in:
parent
1d6cd8daf0
commit
6b24a9cf70
3 changed files with 35 additions and 0 deletions
10
tests/ui/type/pattern_types/macros.active.stderr
Normal file
10
tests/ui/type/pattern_types/macros.active.stderr
Normal 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
|
||||||
|
|
10
tests/ui/type/pattern_types/macros.gated.stderr
Normal file
10
tests/ui/type/pattern_types/macros.gated.stderr
Normal 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
|
||||||
|
|
15
tests/ui/type/pattern_types/macros.rs
Normal file
15
tests/ui/type/pattern_types/macros.rs
Normal 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..)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue