Don't print addr_of(addr_of(e)) as &&e, which means something else.
This commit is contained in:
@@ -1217,6 +1217,11 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
|
|||||||
ast::expr_addr_of(m, expr) => {
|
ast::expr_addr_of(m, expr) => {
|
||||||
word(s.s, ~"&");
|
word(s.s, ~"&");
|
||||||
print_mutability(s, m);
|
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);
|
print_expr(s, expr);
|
||||||
}
|
}
|
||||||
ast::expr_lit(lit) => print_literal(s, lit),
|
ast::expr_lit(lit) => print_literal(s, lit),
|
||||||
|
|||||||
Reference in New Issue
Block a user