Closed
Description
Here is a minimum example of the problem.
macro_rules! size {
($ty:ty) => {
std::mem::size_of::<$ty>()
};
($size:tt) => {
$size
};
}
fn main() {
println!("{}", size!(u32));
println!("{}", size!(4));
}
Compilation fails with following error.
temp.rs:12:26: 12:27 error: expected type, found
4
temp.rs:12 println!("{}", size!(4));
Which means that the fragment qualifier is not taken into account to choose which variant of the macro is to be used.