Skip to content

Commit b99f9f7

Browse files
committed
Enclose type in backticks for "non-exhaustive patterns" error
This makes the error style consistent with the convention in error messages.
1 parent 3991bfb commit b99f9f7

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/librustc_mir/hair/pattern/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
234234
if !scrutinee_is_uninhabited {
235235
// We know the type is inhabited, so this must be wrong
236236
let mut err = create_e0004(self.tcx.sess, scrut.span,
237-
format!("non-exhaustive patterns: type {} \
237+
format!("non-exhaustive patterns: type `{}` \
238238
is non-empty",
239239
pat_ty));
240240
span_help!(&mut err, scrut.span,

src/test/ui/error-codes/E0004-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0004]: non-exhaustive patterns: type std::option::Option<i32> is non-empty
1+
error[E0004]: non-exhaustive patterns: type `std::option::Option<i32>` is non-empty
22
--> $DIR/E0004-2.rs:14:11
33
|
44
LL | match x { } //~ ERROR E0004

src/test/ui/issues/issue-3096-1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0004]: non-exhaustive patterns: type () is non-empty
1+
error[E0004]: non-exhaustive patterns: type `()` is non-empty
22
--> $DIR/issue-3096-1.rs:12:11
33
|
44
LL | match () { } //~ ERROR non-exhaustive

src/test/ui/issues/issue-3096-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0004]: non-exhaustive patterns: type *const bottom is non-empty
1+
error[E0004]: non-exhaustive patterns: type `*const bottom` is non-empty
22
--> $DIR/issue-3096-2.rs:15:11
33
|
44
LL | match x { } //~ ERROR non-exhaustive patterns

src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered
44
LL | let _ = match x { //~ ERROR non-exhaustive
55
| ^ pattern `Err(_)` not covered
66

7-
error[E0004]: non-exhaustive patterns: type &Void is non-empty
7+
error[E0004]: non-exhaustive patterns: type `&Void` is non-empty
88
--> $DIR/uninhabited-matches-feature-gated.rs:20:19
99
|
1010
LL | let _ = match x {}; //~ ERROR non-exhaustive
@@ -16,7 +16,7 @@ help: ensure that all possible cases are being handled, possibly by adding wildc
1616
LL | let _ = match x {}; //~ ERROR non-exhaustive
1717
| ^
1818

19-
error[E0004]: non-exhaustive patterns: type (Void,) is non-empty
19+
error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty
2020
--> $DIR/uninhabited-matches-feature-gated.rs:23:19
2121
|
2222
LL | let _ = match x {}; //~ ERROR non-exhaustive
@@ -28,7 +28,7 @@ help: ensure that all possible cases are being handled, possibly by adding wildc
2828
LL | let _ = match x {}; //~ ERROR non-exhaustive
2929
| ^
3030

31-
error[E0004]: non-exhaustive patterns: type [Void; 1] is non-empty
31+
error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty
3232
--> $DIR/uninhabited-matches-feature-gated.rs:26:19
3333
|
3434
LL | let _ = match x {}; //~ ERROR non-exhaustive

0 commit comments

Comments
 (0)