Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4f7aed6

Browse files
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`
2 parents 267cae5 + 49ca89d commit 4f7aed6

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

‎compiler/rustc_ast_pretty/src/pprust/state/expr.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ impl<'a> State<'a> {
876876
}
877877
}
878878
} else {
879+
self.end(); // Close the ibox for the pattern.
879880
self.word(",");
880881
}
881882
self.end(); // Close enclosing cbox.

‎tests/pretty/never-pattern.pp‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(prelude_import)]
2+
#![no_std]
3+
//@ pretty-mode:expanded
4+
//@ pp-exact:never-pattern.pp
5+
//@ only-x86_64
6+
7+
#![allow(incomplete_features)]
8+
#![feature(never_patterns)]
9+
#![feature(never_type)]
10+
#[prelude_import]
11+
use ::std::prelude::rust_2015::*;
12+
#[macro_use]
13+
extern crate std;
14+
15+
fn f(x: Result<u32, !>) { _ = match x { Ok(x) => x, Err(!) , }; }
16+
17+
fn main() {}

‎tests/pretty/never-pattern.rs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ pretty-mode:expanded
2+
//@ pp-exact:never-pattern.pp
3+
//@ only-x86_64
4+
5+
#![allow(incomplete_features)]
6+
#![feature(never_patterns)]
7+
#![feature(never_type)]
8+
9+
fn f(x: Result<u32, !>) {
10+
_ = match x {
11+
Ok(x) => x,
12+
Err(!),
13+
};
14+
}
15+
16+
fn main() {}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /