about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-24 19:21:04 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-24 19:26:13 +1000
commit49ca89dc36be65872e721bde11ac8efd3ebdd7a1 (patch)
treefde596e4e8a851d1b66e3c81f80d661543409b3d
parent9f497008b0d17cf6b0036eb06eff94fa3850e840 (diff)
downloadrust-49ca89dc36be65872e721bde11ac8efd3ebdd7a1.tar.gz
rust-49ca89dc36be65872e721bde11ac8efd3ebdd7a1.zip
Fix pretty printing of never pattern match arms.
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/expr.rs1
-rw-r--r--tests/pretty/never-pattern.pp5
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
index df848a26d39..4aeb7c00995 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
@@ -876,6 +876,7 @@ impl<'a> State<'a> {
                 }
             }
         } else {
+            self.end(); // Close the ibox for the pattern.
             self.word(",");
         }
         self.end(); // Close enclosing cbox.
diff --git a/tests/pretty/never-pattern.pp b/tests/pretty/never-pattern.pp
index fe40008b971..923ad9b82c7 100644
--- a/tests/pretty/never-pattern.pp
+++ b/tests/pretty/never-pattern.pp
@@ -12,7 +12,6 @@ use ::std::prelude::rust_2015::*;
 #[macro_use]
 extern crate std;
 
-fn f(x: Result<u32, !>) {
-    _ = match x { Ok(x) => x, Err(!) , }; }
+fn f(x: Result<u32, !>) { _ = match x { Ok(x) => x, Err(!) , }; }
 
-    fn main() {}
+fn main() {}