From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/doc/book/redirects/macros.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/doc/book/redirects/macros.md (limited to 'src/doc/book/redirects/macros.md') diff --git a/src/doc/book/redirects/macros.md b/src/doc/book/redirects/macros.md new file mode 100644 index 000000000..08217d115 --- /dev/null +++ b/src/doc/book/redirects/macros.md @@ -0,0 +1,30 @@ +% Macros + +There is a new edition of the book and this is an old link. + +> While functions and types abstract over code, macros abstract at a syntactic level. + +```rust +macro_rules! five_times { + ($x:expr) => (5 * $x); +} + +fn main() { + assert_eq!(25, five_times!(2 + 3)); +} +``` + +--- + +Here are the relevant sections in the new and old books: + +* **[In the current edition: Ch 19.06 Macros][2]** +* [Rust By Example: Macros][3] +* [In the Rust Reference: Ch 3.1 — Macros by Example][4] +* [In the first edition: Ch 3.34 — Macros][1] + + +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/macros.html +[2]: ch19-06-macros.html +[3]: https://rustbyexample.com/macros.html +[4]: ../reference/macros-by-example.html -- cgit v1.2.3