@@ -61,8 +61,9 @@ pub fn check(root_path: &Path, search_paths: &[&Path], bad: &mut bool) {
61
61
62
62
/// Stage 1: Parses a list of error codes from `error_codes.rs`.
63
63
fn extract_error_codes ( root_path : & Path , errors : & mut Vec < String > ) -> Vec < String > {
64
- let file = fs:: read_to_string ( root_path. join ( Path :: new ( ERROR_CODES_PATH ) ) )
65
- . unwrap_or_else ( |e| panic ! ( "failed to read `error_codes.rs`: {e}" ) ) ;
64
+ let path = root_path. join ( Path :: new ( ERROR_CODES_PATH ) ) ;
65
+ let file =
66
+ fs:: read_to_string ( & path) . unwrap_or_else ( |e| panic ! ( "failed to read `{path:?}`: {e}" ) ) ;
66
67
67
68
let mut error_codes = Vec :: new ( ) ;
68
69
let mut reached_undocumented_codes = false ;
@@ -97,7 +98,8 @@ fn extract_error_codes(root_path: &Path, errors: &mut Vec<String>) -> Vec<String
97
98
let expected_filename = format ! ( " include_str!(\" ./error_codes/{}.md\" )," , err_code) ;
98
99
if expected_filename != split_line. unwrap ( ) . 1 {
99
100
errors. push ( format ! (
100
- "Error code `{}` expected to reference docs with `{}` but instead found `{}`" ,
101
+ "Error code `{}` expected to reference docs with `{}` but instead found `{}` in \
102
+ `compiler/rustc_error_codes/src/error_codes.rs`",
101
103
err_code,
102
104
expected_filename,
103
105
split_line. unwrap( ) . 1 ,
@@ -281,7 +283,7 @@ fn check_error_codes_tests(root_path: &Path, error_codes: &[String], errors: &mu
281
283
if IGNORE_UI_TEST_CHECK . contains ( & code. as_str ( ) ) {
282
284
if test_path. exists ( ) {
283
285
errors. push ( format ! (
284
- "Error code `{code}` has a UI test, it shouldn't be listed in `EXEMPTED_FROM_TEST`!"
286
+ "Error code `{code}` has a UI test in `src/test/ui/error-codes/{code}.rs` , it shouldn't be listed in `EXEMPTED_FROM_TEST`!"
285
287
) ) ;
286
288
}
287
289
continue ;
@@ -291,7 +293,7 @@ fn check_error_codes_tests(root_path: &Path, error_codes: &[String], errors: &mu
291
293
Ok ( file) => file,
292
294
Err ( err) => {
293
295
println ! (
294
- "WARNING: Failed to read UI test file for `{code}` but the file exists. The test is assumed to work:\n {err}"
296
+ "WARNING: Failed to read UI test file (`{test_path}`) for `{code}` but the file exists. The test is assumed to work:\n {err}"
295
297
) ;
296
298
continue ;
297
299
}
0 commit comments