From 0dbea7ad549021a6b99aeafcdcdc8af89134d545 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 30 Apr 2023 23:29:40 +0200 Subject: [PATCH] Close parentheses for `offset_of` in AST pretty printing HIR pretty printing already handles it correctly. --- compiler/rustc_ast_pretty/src/pprust/state/expr.rs | 2 +- tests/pretty/offset_of.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 tests/pretty/offset_of.rs diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs index aeb0c762020..defd671989c 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs @@ -566,7 +566,7 @@ pub(super) fn print_expr_outer_attr_style(&mut self, expr: &ast::Expr, is_inline self.print_ident(field); } } - + self.pclose(); self.end(); } ast::ExprKind::MacCall(m) => self.print_mac(m), diff --git a/tests/pretty/offset_of.rs b/tests/pretty/offset_of.rs new file mode 100644 index 00000000000..e1783432857 --- /dev/null +++ b/tests/pretty/offset_of.rs @@ -0,0 +1,4 @@ +// pp-exact +#![feature(offset_of)] + +fn main() { std::mem::offset_of!(std :: ops :: Range < usize >, end); }