about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-01 01:09:50 +0200
committerGitHub <noreply@github.com>2023-05-01 01:09:50 +0200
commit9de14d894b7483c521a7fdfa86301b760f36c3a7 (patch)
tree0a3a4181685b77abfe80c67c7afa3c759ed0adb9
parent7b488f4598ecaa6d78625289831e012d73b86231 (diff)
parent0dbea7ad549021a6b99aeafcdcdc8af89134d545 (diff)
downloadrust-9de14d894b7483c521a7fdfa86301b760f36c3a7.tar.gz
rust-9de14d894b7483c521a7fdfa86301b760f36c3a7.zip
Rollup merge of #111037 - Nilstrieb:close-the-offsetof, r=compiler-errors
Close parentheses for `offset_of` in AST pretty printing

HIR pretty printing already handles it correctly.

This will conflict with #110694 but it seems like that PR is gonna take bit more time.
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/expr.rs2
-rw-r--r--tests/pretty/offset_of.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
index bac8d21eb7a..5511cf851b1 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 @@ impl<'a> State<'a> {
                         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); }