mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 00:00:05 +03:00
macros2 solution
This commit is contained in:
parent
cf90364fd7
commit
9845e046de
|
@ -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