Don't print addr_of(addr_of(e)) as &&e, which means something else.

This commit is contained in:
Jed Davis 2013-03-08 18:43:40 -08:00
parent 2e29f97423
commit 5066bc9ff4

View File

@ -1217,6 +1217,11 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
ast::expr_addr_of(m, expr) => {
word(s.s, ~"&");
print_mutability(s, m);
// Avoid `& &e` => `&&e`.
match (m, &expr.node) {
(ast::m_imm, &ast::expr_addr_of(*)) => space(s.s),
_ => { }
}
print_expr(s, expr);
}
ast::expr_lit(lit) => print_literal(s, lit),