summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exercises/21_macros/macros2.rs1
-rw-r--r--solutions/21_macros/macros2.rs11
2 files changed, 11 insertions, 1 deletions
diff --git a/exercises/21_macros/macros2.rs b/exercises/21_macros/macros2.rs
index f16712b..2d9dec7 100644
--- a/exercises/21_macros/macros2.rs
+++ b/exercises/21_macros/macros2.rs
@@ -2,6 +2,7 @@ fn main() {
my_macro!();
}
+// TODO: Fix the compiler error by moving the whole definition of this macro.
macro_rules! my_macro {
() => {
println!("Check out my macro!");
diff --git a/solutions/21_macros/macros2.rs b/solutions/21_macros/macros2.rs
index 4e18198..b6fd5d2 100644
--- a/solutions/21_macros/macros2.rs
+++ b/solutions/21_macros/macros2.rs
@@ -1 +1,10 @@
-// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
+// Moved the macro definition to be before its call.
+macro_rules! my_macro {
+ () => {
+ println!("Check out my macro!");
+ };
+}
+
+fn main() {
+ my_macro!();
+}