Fill in things needed to stabilize int_error_matching

This commit is contained in:
Ethan Brierley 2020-10-06 14:06:25 +01:00
parent fadf025723
commit c027844795
9 changed files with 66 additions and 64 deletions

View file

@ -46,7 +46,6 @@
#![feature(crate_visibility_modifier)]
#![feature(associated_type_bounds)]
#![feature(rustc_attrs)]
#![feature(int_error_matching)]
#![recursion_limit = "512"]
#[macro_use]

View file

@ -48,10 +48,12 @@ fn update_limit(
.unwrap_or(attr.span);
let error_str = match e.kind() {
IntErrorKind::Overflow => "`limit` is too large",
IntErrorKind::Empty => "`limit` must be a non-negative integer",
IntErrorKind::PosOverflow => "`limit` is too large",
IntErrorKind::Empty | IntErrorKind::OnlySign => {
"`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 underflow"),
IntErrorKind::Zero => bug!("zero is a valid `limit`"),
kind => bug!("unimplemented IntErrorKind variant: {:?}", kind),
};