Skip to content

Commit

Permalink
Enclose type in backticks for "non-exhaustive patterns" error
Browse files Browse the repository at this point in the history
This makes the error style consistent with the convention in error messages.
  • Loading branch information
varkor committed Nov 20, 2018
1 parent 3991bfb commit b99f9f7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
if !scrutinee_is_uninhabited {
// We know the type is inhabited, so this must be wrong
let mut err = create_e0004(self.tcx.sess, scrut.span,
format!("non-exhaustive patterns: type {} \
format!("non-exhaustive patterns: type `{}` \
is non-empty",
pat_ty));
span_help!(&mut err, scrut.span,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0004-2.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0004]: non-exhaustive patterns: type std::option::Option<i32> is non-empty
error[E0004]: non-exhaustive patterns: type `std::option::Option<i32>` is non-empty
--> $DIR/E0004-2.rs:14:11
|
LL | match x { } //~ ERROR E0004
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-3096-1.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0004]: non-exhaustive patterns: type () is non-empty
error[E0004]: non-exhaustive patterns: type `()` is non-empty
--> $DIR/issue-3096-1.rs:12:11
|
LL | match () { } //~ ERROR non-exhaustive
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-3096-2.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0004]: non-exhaustive patterns: type *const bottom is non-empty
error[E0004]: non-exhaustive patterns: type `*const bottom` is non-empty
--> $DIR/issue-3096-2.rs:15:11
|
LL | match x { } //~ ERROR non-exhaustive patterns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered
LL | let _ = match x { //~ ERROR non-exhaustive
| ^ pattern `Err(_)` not covered

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

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

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

0 comments on commit b99f9f7

Please sign in to comment.