From c3f0c9419e39a52758f99c156c41969341ff59da Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Tue, 6 Nov 2018 08:34:30 +0000 Subject: [PATCH] Add very useful documentation --- src/libcore/num/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 7657b45f0246..b8f291f6d050 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4771,6 +4771,7 @@ pub struct ParseIntError { pub kind: IntErrorKind, } +/// Enum to store the various types of errors that can cause parsing an integer to fail. #[unstable(feature = "int_error_matching", reason = "it can be useful to match errors when making error messages \ for integer parsing", @@ -4778,9 +4779,16 @@ pub struct ParseIntError { #[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] pub enum IntErrorKind { + /// Value being parsed is empty. + /// Among other causes, this variant will be constructed when parsing an empty string. Empty, + /// Contains an invalid digit. + /// Among other causes, this variant will be constructed when parsing a string that + /// contains a letter. InvalidDigit, + /// Integer is too small to store in target integer type. Overflow, + /// Integer is too large to store in target integer type. Underflow, }