Skip to content

Commit 0bb6bc4

Browse files
Teach rustc to accept lowercase error codes
1 parent 406d4a9 commit 0bb6bc4

File tree

1 file changed

+6
-2
lines changed
  • compiler/rustc_driver/src

1 file changed

+6
-2
lines changed

compiler/rustc_driver/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,12 @@ fn stderr_isatty() -> bool {
528528
}
529529

530530
fn handle_explain(registry: Registry, code: &str, output: ErrorOutputType) {
531-
let normalised =
532-
if code.starts_with('E') { code.to_string() } else { format!("E{0:0>4}", code) };
531+
let upper_cased_code = code.to_ascii_uppercase();
532+
let normalised = if upper_cased_code.starts_with('E') {
533+
upper_cased_code
534+
} else {
535+
format!("E{0:0>4}", code)
536+
};
533537
match registry.try_find_description(&normalised) {
534538
Ok(Some(description)) => {
535539
let mut is_in_code_block = false;

0 commit comments

Comments
 (0)