mirror of
https://github.com/rust-lang/rustlings
synced 2024-11-14 16:37:14 +00:00
72 lines
445 B
Rust
72 lines
445 B
Rust
// Make me compile! Scroll down for hints :)
|
|
|
|
fn main() {
|
|
my_macro!();
|
|
}
|
|
|
|
macro_rules! my_macro {
|
|
() => {
|
|
println!("Check out my macro!");
|
|
};
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Macros don't quite play by the same rules as the rest of Rust, in terms of
|
|
// what's available where.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Unlike other things in Rust, the order of "where you define a macro" versus
|
|
// "where you use it" actually matters.
|