blob: 1994f25b6a51126961f625007bbc5cb1a5cfca65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// edition:2021
macro_rules! demo2 {
( $a:tt $b:tt ) => { println!("two tokens") };
}
macro_rules! demo3 {
( $a:tt $b:tt $c:tt ) => { println!("three tokens") };
}
macro_rules! demo4 {
( $a:tt $b:tt $c:tt $d:tt ) => { println!("four tokens") };
}
fn main() {
demo3!(foo#bar); //~ ERROR prefix `foo` is unknown
demo2!(foo"bar"); //~ ERROR prefix `foo` is unknown
demo2!(foo'b'); //~ ERROR prefix `foo` is unknown
demo2!(foo'b); //~ ERROR prefix `foo` is unknown
demo3!(foo# bar); //~ ERROR prefix `foo` is unknown
demo4!(foo#! bar); //~ ERROR prefix `foo` is unknown
demo4!(foo## bar); //~ ERROR prefix `foo` is unknown
demo4!(foo#bar#);
//~^ ERROR prefix `foo` is unknown
//~| ERROR prefix `bar` is unknown
demo3!(foo # bar);
demo3!(foo #bar);
demo4!(foo!#bar);
demo4!(foo ##bar);
demo3!(r"foo"#bar);
demo3!(r#foo#bar);
}
|