Open SimonSapin opened 7 years ago
I think you can just put ;
after include!(..)
. The ;
doesn't disturb parsing of the item therein.
The current behavior is that a macro invocation at the start of a statement is considered to be a macro statement if
;
, or{}
to enclose its arguments.Otherwise the macro invocation is considered to be a macro expression, not a macro statement.
I suppose the behavior is intentional. Otherwise the parser would not do such case analysis on parentheses/brackets/braces.
Same error message with a semi-colon:
fn main() {
include!("b.rs");
}
Or curly braces:
fn main() {
include! { "b.rs" }
}
fn main() {
include! { "b.rs" };
}
I was only checking the behavior for another macro. Now I know what you mean. Sorry for bothering you.
I've hit this bug and it's pretty annoying in my case, since I'll have to resort to using build script.
triage: yep, this is still an issue
here's a repro in txtar format.
-- a.rs --
fn main() {
include!("b.rs");
}
-- b.rs --
fn b() {}
a.rs
b.rs
rustc 1.18.0-nightly (2bd4b5c6d 2017-04-23)