mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-21 13:32:23 -05:00
macros2 solution
This commit is contained in:
parent
cf90364fd7
commit
9845e046de
2 changed files with 11 additions and 1 deletions
|
@ -2,6 +2,7 @@ fn main() {
|
||||||
my_macro!();
|
my_macro!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Fix the compiler error by moving the whole definition of this macro.
|
||||||
macro_rules! my_macro {
|
macro_rules! my_macro {
|
||||||
() => {
|
() => {
|
||||||
println!("Check out my macro!");
|
println!("Check out my macro!");
|
||||||
|
|
|
@ -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!();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue