-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Chapter 17.2: undescribed repetition pattern? #1955
Copy link
Copy link
Open
Description
Code example in chapter 17.2 has the following macro defined:
macro_rules! assert_equal_len {
// The `tt` (token tree) designator is used for
// operators and tokens.
($a:expr, $b:expr, $func:ident, $op:tt) => {
assert!($a.len() == $b.len(),
"{:?}: dimension mismatch: {:?} {:?} {:?}",
stringify!($func),
($a.len(),),
stringify!($op),
($b.len(),));
};
}It is unclear why $a.len() and $b.len() are wrapped in parentheses with a trailing comma inside after the expression - looks like it could mean multiple instances (or lack) of an expression, but the context does not seem to allow for that. What is the purpose of that syntax?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.