summaryrefslogtreecommitdiffstats
path: root/src/doc/book/redirects/macros.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/redirects/macros.md')
-rw-r--r--src/doc/book/redirects/macros.md30
1 files changed, 30 insertions, 0 deletions
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
+
+<small>There is a new edition of the book and this is an old link.</small>
+
+> 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]
+* <small>[In the first edition: Ch 3.34 — Macros][1]</small>
+
+
+[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