Skip to content

Commit 5066bc9

Browse files
committed
Don't print addr_of(addr_of(e)) as &&e, which means something else.
1 parent 2e29f97 commit 5066bc9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libsyntax/print/pprust.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,11 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
12171217
ast::expr_addr_of(m, expr) => {
12181218
word(s.s, ~"&");
12191219
print_mutability(s, m);
1220+
// Avoid `& &e` => `&&e`.
1221+
match (m, &expr.node) {
1222+
(ast::m_imm, &ast::expr_addr_of(*)) => space(s.s),
1223+
_ => { }
1224+
}
12201225
print_expr(s, expr);
12211226
}
12221227
ast::expr_lit(lit) => print_literal(s, lit),

0 commit comments

Comments
 (0)