Rollup merge of #140246 - nnethercote:fix-never-pattern-printing, r=Nadrieril

Fix never pattern printing

It's currently broken, but there's an easy fix.

r? `@Nadrieril`
This commit is contained in:
Matthias Krüger 2025-04-27 16:08:58 +02:00 committed by GitHub
commit 4f7aed6791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 0 deletions

View file

@ -876,6 +876,7 @@ impl<'a> State<'a> {
}
}
} else {
self.end(); // Close the ibox for the pattern.
self.word(",");
}
self.end(); // Close enclosing cbox.

View file

@ -0,0 +1,17 @@
#![feature(prelude_import)]
#![no_std]
//@ pretty-mode:expanded
//@ pp-exact:never-pattern.pp
//@ only-x86_64
#![allow(incomplete_features)]
#![feature(never_patterns)]
#![feature(never_type)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
fn f(x: Result<u32, !>) { _ = match x { Ok(x) => x, Err(!) , }; }
fn main() {}

View file

@ -0,0 +1,16 @@
//@ pretty-mode:expanded
//@ pp-exact:never-pattern.pp
//@ only-x86_64
#![allow(incomplete_features)]
#![feature(never_patterns)]
#![feature(never_type)]
fn f(x: Result<u32, !>) {
_ = match x {
Ok(x) => x,
Err(!),
};
}
fn main() {}