Rollup merge of #86533 - inquisitivecrystal:lower-case-error-explain, r=petrochenkov
Support lowercase error codes in `--explain` This enables `rustc --explain` to accept a lowercase error code. Thus, for instance, `rustc --explain e0573` would be valid after this change, where before a user would have needed to do `rustc --explain E0573`. Although the upper case form of an error code is canonical, the user may prefer the easier-to-type lowercase form, and there's nothing to be gained by forcing them to type the upper case version. Resolves #86518.
This commit is contained in:
commit
6b618c82ba
1 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue