diff options
| author | Ezra Shaw <ezrasure@outlook.com> | 2023-01-02 09:15:36 +1300 |
|---|---|---|
| committer | Ezra Shaw <ezrasure@outlook.com> | 2023-01-02 09:15:36 +1300 |
| commit | 24671b7fd5daf16a39d6c9c62a457ace0b9c3ff6 (patch) | |
| tree | 55d92ea15b4438c35558464b730d8e875ac8dafc | |
| parent | 9618f646b314f934fe4ff92d6424255573c65a1c (diff) | |
| download | rust-24671b7fd5daf16a39d6c9c62a457ace0b9c3ff6.tar.gz rust-24671b7fd5daf16a39d6c9c62a457ace0b9c3ff6.zip | |
use more paths in error codes
| -rw-r--r-- | src/tools/tidy/src/error_codes.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/tools/tidy/src/error_codes.rs b/src/tools/tidy/src/error_codes.rs index b766f166718..026f7d87418 100644 --- a/src/tools/tidy/src/error_codes.rs +++ b/src/tools/tidy/src/error_codes.rs @@ -61,8 +61,9 @@ pub fn check(root_path: &Path, search_paths: &[&Path], bad: &mut bool) { /// Stage 1: Parses a list of error codes from `error_codes.rs`. fn extract_error_codes(root_path: &Path, errors: &mut Vec<String>) -> Vec<String> { - let file = fs::read_to_string(root_path.join(Path::new(ERROR_CODES_PATH))) - .unwrap_or_else(|e| panic!("failed to read `error_codes.rs`: {e}")); + let path = root_path.join(Path::new(ERROR_CODES_PATH)); + let file = + fs::read_to_string(&path).unwrap_or_else(|e| panic!("failed to read `{path:?}`: {e}")); let mut error_codes = Vec::new(); let mut reached_undocumented_codes = false; @@ -97,7 +98,8 @@ fn extract_error_codes(root_path: &Path, errors: &mut Vec<String>) -> Vec<String let expected_filename = format!(" include_str!(\"./error_codes/{}.md\"),", err_code); if expected_filename != split_line.unwrap().1 { errors.push(format!( - "Error code `{}` expected to reference docs with `{}` but instead found `{}`", + "Error code `{}` expected to reference docs with `{}` but instead found `{}` in \ + `compiler/rustc_error_codes/src/error_codes.rs`", err_code, expected_filename, split_line.unwrap().1, @@ -281,7 +283,7 @@ fn check_error_codes_tests(root_path: &Path, error_codes: &[String], errors: &mu if IGNORE_UI_TEST_CHECK.contains(&code.as_str()) { if test_path.exists() { errors.push(format!( - "Error code `{code}` has a UI test, it shouldn't be listed in `EXEMPTED_FROM_TEST`!" + "Error code `{code}` has a UI test in `src/test/ui/error-codes/{code}.rs`, it shouldn't be listed in `EXEMPTED_FROM_TEST`!" )); } continue; @@ -291,7 +293,7 @@ fn check_error_codes_tests(root_path: &Path, error_codes: &[String], errors: &mu Ok(file) => file, Err(err) => { println!( - "WARNING: Failed to read UI test file for `{code}` but the file exists. The test is assumed to work:\n{err}" + "WARNING: Failed to read UI test file (`{test_path}`) for `{code}` but the file exists. The test is assumed to work:\n{err}" ); continue; } |
