Skip to content

Commit cfd4e97

Browse files
Fix ui tests with better error code usage
1 parent cd27463 commit cfd4e97

31 files changed

+39
-22
lines changed

src/test/ui/asm/asm-bad-clobber.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | asm!("xor %eax, %eax" : : : "{eax}");
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0664`.

src/test/ui/asm/asm-in-bad-modifier.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5));
1212

1313
error: aborting due to 2 previous errors
1414

15+
Some errors have detailed explanations: E0662, E0663.
16+
For more information about an error, try `rustc --explain E0662`.

src/test/ui/asm/asm-out-no-modifier.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | asm!("mov $1, $0" : "r"(x) : "r"(5));
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0661`.

src/test/ui/asm/issue-51431.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)}
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0669`.

src/test/ui/bad/bad-intrinsic-monomorphization.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ LL | simd_add(a, b)
1818

1919
error: aborting due to 3 previous errors
2020

21+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/error-codes/E0511.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | unsafe { simd_add(0, 1); }
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/error-codes/E0660.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ LL | asm!("nop" "nop" : "=r"(a));
1212

1313
error: aborting due to 2 previous errors
1414

15+
For more information about this error, try `rustc --explain E0660`.

src/test/ui/error-codes/E0661.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ LL | let a;
1212

1313
error: aborting due to 2 previous errors
1414

15-
For more information about this error, try `rustc --explain E0282`.
15+
Some errors have detailed explanations: E0282, E0661.
16+
For more information about an error, try `rustc --explain E0282`.

src/test/ui/error-codes/E0662.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | : "=test"("a")
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0662`.

src/test/ui/error-codes/E0663.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | : "+test"("a")
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0663`.

src/test/ui/error-codes/E0664.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | : "{eax}"
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0664`.

src/test/ui/error-codes/E0665.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | #[derive(Default)]
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0665`.

src/test/ui/explain.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Per [RFC 401][rfc401], if you have a function declaration `foo`:
1+
er [RFC 401][rfc401], if you have a function declaration `foo`:
22

33
```
44
// For the purposes of this explanation, all of these

src/test/ui/inline-asm-bad-constraint.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ LL | asm!("addb $1, $0" : "={rax}"((0i32, rax)));
1818

1919
error: aborting due to 3 previous errors
2020

21+
For more information about this error, try `rustc --explain E0668`.

src/test/ui/inline-asm-bad-operand.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ LL | ... "r"("hello e0669"));
4242

4343
error: aborting due to 7 previous errors
4444

45+
For more information about this error, try `rustc --explain E0669`.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | asm!("" :: "r"(""));
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0669`.

src/test/ui/issues/issue-53787-inline-assembler-macro.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | fake_jump!("FirstFunc");
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0669`.

src/test/ui/json-bom-plus-crlf-multifile.stderr

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
2-
This error occurs when the compiler was unable to infer the concrete type of a
1+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
32
variable. It can occur for several cases, the most common of which is a
43
mismatch in the expected type that the compiler inferred for a variable's
54
initializing expression, and the actual type explicitly assigned to the
@@ -19,8 +18,7 @@ let x: i32 = \"I am not a number!\";
1918
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String`
2019
found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types
2120
"}
22-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
23-
This error occurs when the compiler was unable to infer the concrete type of a
21+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
2422
variable. It can occur for several cases, the most common of which is a
2523
mismatch in the expected type that the compiler inferred for a variable's
2624
initializing expression, and the actual type explicitly assigned to the
@@ -40,8 +38,7 @@ let x: i32 = \"I am not a number!\";
4038
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String`
4139
found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types
4240
"}
43-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
44-
This error occurs when the compiler was unable to infer the concrete type of a
41+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
4542
variable. It can occur for several cases, the most common of which is a
4643
mismatch in the expected type that the compiler inferred for a variable's
4744
initializing expression, and the actual type explicitly assigned to the
@@ -61,8 +58,7 @@ let x: i32 = \"I am not a number!\";
6158
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String`
6259
found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types
6360
"}
64-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
65-
This error occurs when the compiler was unable to infer the concrete type of a
61+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
6662
variable. It can occur for several cases, the most common of which is a
6763
mismatch in the expected type that the compiler inferred for a variable's
6864
initializing expression, and the actual type explicitly assigned to the

src/test/ui/json-bom-plus-crlf.stderr

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
2-
This error occurs when the compiler was unable to infer the concrete type of a
1+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
32
variable. It can occur for several cases, the most common of which is a
43
mismatch in the expected type that the compiler inferred for a variable's
54
initializing expression, and the actual type explicitly assigned to the
@@ -19,8 +18,7 @@ let x: i32 = \"I am not a number!\";
1918
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String`
2019
found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:17:22: error[E0308]: mismatched types
2120
"}
22-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
23-
This error occurs when the compiler was unable to infer the concrete type of a
21+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
2422
variable. It can occur for several cases, the most common of which is a
2523
mismatch in the expected type that the compiler inferred for a variable's
2624
initializing expression, and the actual type explicitly assigned to the
@@ -40,8 +38,7 @@ let x: i32 = \"I am not a number!\";
4038
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String`
4139
found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:19:22: error[E0308]: mismatched types
4240
"}
43-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
44-
This error occurs when the compiler was unable to infer the concrete type of a
41+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
4542
variable. It can occur for several cases, the most common of which is a
4643
mismatch in the expected type that the compiler inferred for a variable's
4744
initializing expression, and the actual type explicitly assigned to the
@@ -61,8 +58,7 @@ let x: i32 = \"I am not a number!\";
6158
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `std::string::String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"expected type `std::string::String`
6259
found type `{integer}`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:23:1: error[E0308]: mismatched types
6360
"}
64-
{"message":"mismatched types","code":{"code":"E0308","explanation":"
65-
This error occurs when the compiler was unable to infer the concrete type of a
61+
{"message":"mismatched types","code":{"code":"E0308","explanation":"This error occurs when the compiler was unable to infer the concrete type of a
6662
variable. It can occur for several cases, the most common of which is a
6763
mismatch in the expected type that the compiler inferred for a variable's
6864
initializing expression, and the actual type explicitly assigned to the

src/test/ui/json-short.stderr

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{"message":"`main` function not found in crate `json_short`","code":{"code":"E0601","explanation":"
2-
No `main` function was found in a binary crate. To fix this error, add a
1+
{"message":"`main` function not found in crate `json_short`","code":{"code":"E0601","explanation":"No `main` function was found in a binary crate. To fix this error, add a
32
`main` function. For example:
43

54
```

src/test/ui/lint/use_suggestion_json.stderr

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"message": "cannot find type `Iter` in this scope",
33
"code": {
44
"code": "E0412",
5-
"explanation": "
6-
The type name used is not in scope.
5+
"explanation": "The type name used is not in scope.
76

87
Erroneous code examples:
98

src/test/ui/macros/macros-nonfatal-errors.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,4 @@ LL | trace_macros!(invalid);
8989

9090
error: aborting due to 14 previous errors
9191

92+
For more information about this error, try `rustc --explain E0665`.

src/test/ui/non-integer-atomic.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,4 @@ LL | intrinsics::atomic_cxchg(p, v, v);
9696

9797
error: aborting due to 16 previous errors
9898

99+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ LL | simd_saturating_sub(z, z);
1212

1313
error: aborting due to 2 previous errors
1414

15+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ LL | simd_xor(z, z);
8484

8585
error: aborting due to 14 previous errors
8686

87+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ LL | let _: u128 = simd_bitmask(m64);
3030

3131
error: aborting due to 5 previous errors
3232

33+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ LL | simd_cast::<_, i32x8>(x);
2424

2525
error: aborting due to 4 previous errors
2626

27+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@ LL | simd_ge::<_, i16x8>(x, x);
108108

109109
error: aborting due to 18 previous errors
110110

111+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,4 @@ LL | simd_shuffle8::<_, i32x2>(x, x, [0; 8]);
9090

9191
error: aborting due to 15 previous errors
9292

93+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ LL | let _: bool = simd_reduce_any(z);
6060

6161
error: aborting due to 10 previous errors
6262

63+
For more information about this error, try `rustc --explain E0511`.

src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ LL | simd_select_bitmask("x", x, x);
4848

4949
error: aborting due to 8 previous errors
5050

51+
For more information about this error, try `rustc --explain E0511`.

0 commit comments

Comments
 (0)