From 0bb6bc40ce8d544ca41006d3faf8bcda2152030f Mon Sep 17 00:00:00 2001 From: Aris Merchant <22333129+inquisitivecrystal@users.noreply.github.com> Date: Mon, 21 Jun 2021 18:11:53 -0700 Subject: [PATCH] Teach rustc to accept lowercase error codes --- compiler/rustc_driver/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index b943977e4c2bb..87bc829b48891 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -528,8 +528,12 @@ fn stderr_isatty() -> bool { } fn handle_explain(registry: Registry, code: &str, output: ErrorOutputType) { - let normalised = - if code.starts_with('E') { code.to_string() } else { format!("E{0:0>4}", code) }; + let upper_cased_code = code.to_ascii_uppercase(); + let normalised = if upper_cased_code.starts_with('E') { + upper_cased_code + } else { + format!("E{0:0>4}", code) + }; match registry.try_find_description(&normalised) { Ok(Some(description)) => { let mut is_in_code_block = false;