-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-syntaxextArea: Syntax extensionsArea: Syntax extensions
Description
Code included with include!(...)
macro does not see local variables.
To reproduce you need two files: included.rs and main.rs:
included.rs:
zzz
main.rs:
fn main() {
let zzz = 1;
let www = include!("included.rs");
}
Error is:
$ rustc ./main.rs
main.rs:3:15: 3:39 error: unresolved name `zzz`.
main.rs:3 let www = include!("included.rs");
^~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /rust/src/libsyntax/diagnostic.rs:75
task '<main>' failed at 'explicit failure', /rust/src/librustc/lib.rs:440
Though it works well when zzz
is global variable:
static zzz: int = 1;
fn main() {
let www = include!("included.rs");
}
Metadata
Metadata
Assignees
Labels
A-syntaxextArea: Syntax extensionsArea: Syntax extensions