Skip to content

Commit aebf07e

Browse files
Rollup merge of rust-lang#56114 - varkor:nonexhaustive-backticks, r=nikomatsakis
Enclose type in backticks for "non-exhaustive patterns" error This makes the error style consistent with the convention in error messages.
2 parents 36a4abf + f039872 commit aebf07e

File tree

12 files changed

+17
-17
lines changed

12 files changed

+17
-17
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/librustc_typeck/check/autoderef.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ impl<'a, 'gcx, 'tcx> Iterator for Autoderef<'a, 'gcx, 'tcx> {
5959
if self.steps.len() >= *tcx.sess.recursion_limit.get() {
6060
// We've reached the recursion limit, error gracefully.
6161
let suggested_limit = *tcx.sess.recursion_limit.get() * 2;
62-
let msg = format!("reached the recursion limit while auto-dereferencing {:?}",
62+
let msg = format!("reached the recursion limit while auto-dereferencing `{:?}`",
6363
self.cur_ty);
6464
let error_id = (DiagnosticMessageId::ErrorId(55), Some(self.span), msg);
6565
let fresh = tcx.sess.one_time_diagnostics.borrow_mut().insert(error_id);
6666
if fresh {
6767
struct_span_err!(tcx.sess,
6868
self.span,
6969
E0055,
70-
"reached the recursion limit while auto-dereferencing {:?}",
70+
"reached the recursion limit while auto-dereferencing `{:?}`",
7171
self.cur_ty)
7272
.span_label(self.span, "deref recursion limit reached")
7373
.help(&format!(

src/librustc_typeck/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ fn main() {
538538
let foo = Foo;
539539
let ref_foo = &&Foo;
540540
541-
// error, reached the recursion limit while auto-dereferencing &&Foo
541+
// error, reached the recursion limit while auto-dereferencing `&&Foo`
542542
ref_foo.foo();
543543
}
544544
```

src/test/ui/did_you_mean/recursion_limit_deref.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0055]: reached the recursion limit while auto-dereferencing I
1+
error[E0055]: reached the recursion limit while auto-dereferencing `I`
22
--> $DIR/recursion_limit_deref.rs:60:22
33
|
44
LL | let x: &Bottom = &t; //~ ERROR mismatched types

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/error-codes/E0055.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0055]: reached the recursion limit while auto-dereferencing Foo
1+
error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
22
--> $DIR/E0055.rs:21:13
33
|
44
LL | ref_foo.foo();

src/test/ui/infinite/infinite-autoderef.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ LL | x = box x;
77
| cyclic type of infinite size
88
| help: try using a conversion method: `box x.to_string()`
99

10-
error[E0055]: reached the recursion limit while auto-dereferencing Foo
10+
error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
1111
--> $DIR/infinite-autoderef.rs:35:5
1212
|
1313
LL | Foo.foo;
1414
| ^^^^^^^ deref recursion limit reached
1515
|
1616
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
1717

18-
error[E0055]: reached the recursion limit while auto-dereferencing Foo
18+
error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
1919
--> $DIR/infinite-autoderef.rs:35:9
2020
|
2121
LL | Foo.foo;
@@ -29,7 +29,7 @@ error[E0609]: no field `foo` on type `Foo`
2929
LL | Foo.foo;
3030
| ^^^ unknown field
3131

32-
error[E0055]: reached the recursion limit while auto-dereferencing Foo
32+
error[E0055]: reached the recursion limit while auto-dereferencing `Foo`
3333
--> $DIR/infinite-autoderef.rs:36:9
3434
|
3535
LL | Foo.bar();

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/issues/issue-38940.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ fn main() {
4242
let t = Top::new();
4343
let x: &Bottom = &t;
4444
//~^ ERROR mismatched types
45-
//~| ERROR reached the recursion limit while auto-dereferencing I
45+
//~| ERROR reached the recursion limit while auto-dereferencing `I`
4646
}

src/test/ui/issues/issue-38940.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0055]: reached the recursion limit while auto-dereferencing I
1+
error[E0055]: reached the recursion limit while auto-dereferencing `I`
22
--> $DIR/issue-38940.rs:43:22
33
|
44
LL | let x: &Bottom = &t;

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)