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.