-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve span when lowering ExprKind::Paren #33683
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ rollup |
📌 Commit 0f257df has been approved by |
@bors r- , fails travis
|
This is trickier than I thought. The problem is illustrated by the following code: macro_rules! paren {
($e:expr) => (($e))
}
mod m {
pub struct S {
x: i32
}
pub fn make() -> S {
S { x: 0 }
}
}
fn main() {
let s = m::make();
paren!(s.x);
} Before:
After:
|
Since Rust macro is not text substitution, there is never a need to parenthesize like |
Why wouldn't we?
Hmm. So... it seems like your highlighting code was doing the right thing, but perhaps |
Modified |
Now suboptimal highlighting is avoided. |
@bors r+ rollup I'm not sure which is better, but this seems good too. |
📌 Commit edf1773 has been approved by |
Preserve span when lowering ExprKind::Paren Fix rust-lang#33681.
Fix #33681.