-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split current "macro_rules" chapter ", cover more topics #110
Comments
This is applicable here for when you expand on macros. In macros example repeat.rs I find the ($x:expr, $($y:expr),+) => {std::cmp::min($x, min!($($y),+)) } It's unclear what // Assume `+` applies to previous character only
$(...), $(...),,,,,,,,, // Could match
// Using [x,y) range notation on the next line:
// Assume `+` applies to range [$(...),+)
$(...), $(...), $(...), // Could match (note the last comma)
// `+` always duplicates everything so there should be a final `,`
$(...), $(...), $(...) // Don't expect to match (note the last comma is missing) If $($x:expr, )+$y:expr // Possible way to write it
$x:expr $($y:expr),+ $($z:expr) // Z needed to handle missing comma Calls fail similarly: min!(1u, 2u, ); // Surprisingly fails
min!(1u, 2u); // Succeeds though!?! |
I'm going to close this issue as stale; there are improvements to be made here, but most of this ticket isn't relevant in today's Rust. |
This chapter needs splitting:
macro_rules
is behind a feature gate + simple example (no arguments)$foo:expr
do!($this and $that)
+
and*
expansionWe also want to cover:
#[phase(plugin)]
The text was updated successfully, but these errors were encountered: