ascent
ascent copied to clipboard
Hygenie issue in `ascent_src!`
ascent_src! don't have capture ability for var defined outside src due to macro hygenie issue. Maybe we can consider allow declaration of captured var in syntax?
Code failed now:
#[test]
fn test_macro() {
let z = 1;
mod foom {
use super::*;
ascent_source! {
foo_gen ():
foo(x, y) <-- foo(y, x), let _ = z;
}
}
ascent_run! {
// struct MacroTest;
relation foo(usize, usize);
include_source!(foom::foo_gen);
};
}
error message:
error[E0425]: cannot find value `z` in this scope
--> ascent/examples/ascent_source.rs:27:43
|
27 | foo(x, y) <-- foo(y, x), let _ = z;
| ^ help: a local variable with a similar name exists: `x`
...
33 | include_source!(foom::foo_gen);
| ------------- in this macro invocation
|
= note: this error originates in the macro `foom::foo_gen` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0425`.
error: could not compile `ascent` (example "ascent_source" test) due to 1 previous error