-
Notifications
You must be signed in to change notification settings - Fork 13.4k
lambda-var hygiene #9383
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
What exactly does this ticket ask? The following already works out-of-box: #[feature(macro_rules)];
macro_rules! macro_invoke (($ex:expr) => ({let _x = 9; $ex()}))
pub fn main() {
let _x = 8;
assert_eq!(macro_invoke!(|| _x),8)
} |
@jbclements I couldn't find any test with #9383 in it. Does @edwardw comment address what you meant? If so, we can mark this issue as needtest. |
No, it's still wrong. This is referring to function/lambda arguments. The following compiles and prints #[feature(macro_rules)];
macro_rules! wrong {
($e: expr) => {
(|x| { $e })(1)
}
}
macro_rules! right {
($e: expr) => {
{ let x = 1; $e }
}
}
fn main() {
println!("{}", wrong!(x));
// println!("{}", right!(x));
} (Uncommenting the |
Oops, yes, closed by #15425 . |
lambda vars and function arguments should be treated hygienically. This is a placeholder bug to attach to some xfailed tests. FWIW, I think this is not a huge amount of work.
The text was updated successfully, but these errors were encountered: