mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-12 11:14:55 +02:00
2cdd61294f
The `watch` command now requires user action to move to the next exercise. BREAKING CHANGE: this changes the behavior of `watch`.
78 lines
606 B
Rust
78 lines
606 B
Rust
// macros3.rs
|
|
// Make me compile, without taking the macro out of the module! Scroll down for hints :)
|
|
|
|
// I AM NOT DONE
|
|
|
|
mod macros {
|
|
macro_rules! my_macro {
|
|
() => {
|
|
println!("Check out my macro!");
|
|
};
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
my_macro!();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// In order to use a macro outside of its module, you need to do something
|
|
// special to the module to lift the macro out into its parent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The same trick also works on "extern crate" statements for crates that have
|
|
// exported macros, if you've seen any of those around.
|