summary refs log tree commit diff
path: root/compiler/rustc_driver_impl
diff options
context:
space:
mode:
authorKivooeo <Kivooeo123@gmail.com>2025-05-06 15:06:45 +0500
committerKivooeo <Kivooeo123@gmail.com>2025-05-06 23:02:47 +0500
commit3c1c0726ad18dc07f3ef9b9465d5997ca13e332c (patch)
tree26a7975d1de350e6328ad3e05f73c2fbd1d250a0 /compiler/rustc_driver_impl
parent651e9cf327358b28db7e37a2ae61727f4a2ef232 (diff)
downloadrust-3c1c0726ad18dc07f3ef9b9465d5997ca13e332c.tar.gz
rust-3c1c0726ad18dc07f3ef9b9465d5997ca13e332c.zip
added error handle for error code > 9999
Diffstat (limited to 'compiler/rustc_driver_impl')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index fdf8053b15a..95cfe221d3f 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -463,6 +463,7 @@ fn handle_explain(early_dcx: &EarlyDiagCtxt, registry: Registry, code: &str, col
     // Allow "E0123" or "0123" form.
     let upper_cased_code = code.to_ascii_uppercase();
     if let Ok(code) = upper_cased_code.strip_prefix('E').unwrap_or(&upper_cased_code).parse::<u32>()
+        && code <= ErrCode::MAX_AS_U32
         && let Ok(description) = registry.try_find_description(ErrCode::from_u32(code))
     {
         let mut is_in_code_block = false;