If you have a file that invokes a macro and you include! it, the following happens:
main.rs
fn main() {
macro_rules! my_macro {
($name:expr) => {{
printn!("{}", $name);
}}
}
include!("helper.rs");
}
helper.rs
my_macro!("foo");
my_macro!("bar");
STR
$ rustc main.rs
$ ./main
foo
Expected output
Should print foo and bar, just as if the code would have been inlined.
Tested with latest nightly and stable:
rustc 1.12.0-nightly (080e0e072 2016-08-08)
rustc 1.10.0 (cfcb716cf 2016-07-03)
If you have a file that invokes a macro and you
include!it, the following happens:main.rshelper.rsSTR
Expected output
Should print
fooandbar, just as if the code would have been inlined.Tested with latest nightly and stable: