Rollup merge of #77640 - ethanboxx:int_error_matching_attempt_2, r=KodrAus
Refactor IntErrorKind to avoid "underflow" terminology This PR is a continuation of #76455 # Changes - `Overflow` renamed to `PosOverflow` and `Underflow` renamed to `NegOverflow` after discussion in #76455 - Changed some of the parsing code to return `InvalidDigit` rather than `Empty` for strings "+" and "-". https://users.rust-lang.org/t/misleading-error-in-str-parse-for-int-types/49178 - Carry the problem `char` with the `InvalidDigit` variant. - Necessary changes were made to the compiler as it depends on `int_error_matching`. - Redid tests to match on specific errors. r? ```@KodrAus```
This commit is contained in:
commit
d69ee57f97
6 changed files with 69 additions and 46 deletions
|
@ -48,10 +48,12 @@ fn update_limit(
|
|||
.unwrap_or(attr.span);
|
||||
|
||||
let error_str = match e.kind() {
|
||||
IntErrorKind::Overflow => "`limit` is too large",
|
||||
IntErrorKind::PosOverflow => "`limit` is too large",
|
||||
IntErrorKind::Empty => "`limit` must be a non-negative integer",
|
||||
IntErrorKind::InvalidDigit => "not a valid integer",
|
||||
IntErrorKind::Underflow => bug!("`limit` should never underflow"),
|
||||
IntErrorKind::NegOverflow => {
|
||||
bug!("`limit` should never negatively overflow")
|
||||
}
|
||||
IntErrorKind::Zero => bug!("zero is a valid `limit`"),
|
||||
kind => bug!("unimplemented IntErrorKind variant: {:?}", kind),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue