Skip to content

Commit 7857c38

Browse files
committed
optimized some stuff
1 parent b52df8d commit 7857c38

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

compiler/rustc_driver_impl/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ fn handle_explain(early_dcx: &EarlyDiagCtxt, registry: Registry, code: &str, col
463463
// Allow "E0123" or "0123" form.
464464
let upper_cased_code = code.to_ascii_uppercase();
465465
if let Ok(code) = upper_cased_code.strip_prefix('E').unwrap_or(&upper_cased_code).parse::<u32>()
466+
&& code <= ErrCode::MAX_AS_U32
466467
&& let Ok(description) = registry.try_find_description(ErrCode::from_u32(code))
467468
{
468469
let mut is_in_code_block = false;

compiler/rustc_errors/src/codes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use std::fmt;
88

99
rustc_index::newtype_index! {
10+
#[max = 9999]
1011
#[orderable]
1112
#[encodable]
1213
#[debug_format = "ErrCode({})"]

0 commit comments

Comments
 (0)