I think "Yes" is the more correct answer. Here’s an example:
#![feature(trace_macros)]
trace_macros!(true);
macro_rules! product {
($($e1:expr),* ; $($e2:expr),*) => {
product_helper_1!([$([$e1])*][$([$e2])*])
}
}
macro_rules! product_helper_1 {
([$([$e1:expr])*]$e2:tt) => {
product_helper_2!($([[$e1]$e2])*)
}
}
macro_rules! product_helper_2 {
($([[$e1:expr][$([$e2:expr])*]])*) => {
[$($(($e1 + $e2)),*),*]
}
}
fn main(){
dbg!(product!(0,10,20,30,40,50; 0,1,2,3,4,5,6,7,8,9));
}
(playground)
Output:
Compiling playground v0.0.1 (/playground)
note: trace_macro
--> src/main.rs:21:5
|
21 | dbg!(product!(0,10,20,30,40,50; 0,1,2,3,4,5,6,7,8,9));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `dbg! { product ! (0, 10, 20, 30, 40, 50 ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) }`
= note: to `match product!(0, 10, 20, 30, 40, 50 ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
{
tmp =>
{
$crate :: eprintln !
("[{}:{}] {} = {:#?}", $crate :: file ! (), $crate :: line ! (),
$crate :: stringify !
(product!(0, 10, 20, 30, 40, 50 ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)), &
tmp) ; tmp
}
}`
= note: expanding `eprintln! { "[{}:{}] {} = {:#?}", $crate :: file ! (), $crate :: line ! (), $crate ::
stringify ! (product!(0, 10, 20, 30, 40, 50 ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)),
& tmp }`
= note: to `{
$crate :: io ::
_eprint($crate :: format_args_nl !
("[{}:{}] {} = {:#?}", $crate :: file ! (), $crate :: line ! (),
$crate :: stringify !
(product!(0, 10, 20, 30, 40, 50 ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)),
& tmp)) ;
}`
note: trace_macro
--> src/main.rs:21:10
|
21 | dbg!(product!(0,10,20,30,40,50; 0,1,2,3,4,5,6,7,8,9));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `product! { 0, 10, 20, 30, 40, 50 ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }`
= note: to `product_helper_1 !
([[0] [10] [20] [30] [40] [50]] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]])`
= note: expanding `product_helper_1! { [[0] [10] [20] [30] [40] [50]] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]] }`
= note: to `product_helper_2 !
([[0] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[10] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[20] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[30] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[40] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[50] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]])`
= note: expanding `product_helper_2! { [[0] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[10] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[20] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[30] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[40] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]]
[[50] [[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]] }`
= note: to `[(0 + 0), (0 + 1), (0 + 2), (0 + 3), (0 + 4), (0 + 5), (0 + 6), (0 + 7),
(0 + 8), (0 + 9), (10 + 0), (10 + 1), (10 + 2), (10 + 3), (10 + 4), (10 + 5),
(10 + 6), (10 + 7), (10 + 8), (10 + 9), (20 + 0), (20 + 1), (20 + 2),
(20 + 3), (20 + 4), (20 + 5), (20 + 6), (20 + 7), (20 + 8), (20 + 9),
(30 + 0), (30 + 1), (30 + 2), (30 + 3), (30 + 4), (30 + 5), (30 + 6),
(30 + 7), (30 + 8), (30 + 9), (40 + 0), (40 + 1), (40 + 2), (40 + 3),
(40 + 4), (40 + 5), (40 + 6), (40 + 7), (40 + 8), (40 + 9), (50 + 0),
(50 + 1), (50 + 2), (50 + 3), (50 + 4), (50 + 5), (50 + 6), (50 + 7),
(50 + 8), (50 + 9)]`
Finished dev [unoptimized + debuginfo] target(s) in 0.82s
Running `target/debug/playground`
[src/main.rs:21] product!(0, 10, 20, 30, 40, 50 ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) = [
0,
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,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
]