-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
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.
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)