From a9779df1886e18923f40cf0bb67ab72d4e4942df Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 4 May 2016 22:42:14 -0700 Subject: Implement RFC 1542 cc #33417 --- src/libstd/error.rs | 7 +++++++ src/libstd/lib.rs | 1 + src/libstd/num/mod.rs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 35cd4a5ec52..d49d9764946 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -159,6 +159,13 @@ impl Error for num::ParseIntError { } } +#[unstable(feature = "try_from", issue = "33417")] +impl Error for num::TryFromIntError { + fn description(&self) -> &str { + self.__description() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Error for num::ParseFloatError { fn description(&self) -> &str { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e14a31453d3..d4b40b844fc 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -270,6 +270,7 @@ #![feature(vec_push_all)] #![feature(zero_one)] #![feature(question_mark)] +#![feature(try_from)] // Issue# 30592: Systematically use alloc_system during stage0 since jemalloc // might be unavailable or disabled diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 1886b4fdf59..d33df05acf2 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -19,7 +19,7 @@ #[stable(feature = "rust1", since = "1.0.0")] pub use core::num::{Zero, One}; #[stable(feature = "rust1", since = "1.0.0")] -pub use core::num::{FpCategory, ParseIntError, ParseFloatError}; +pub use core::num::{FpCategory, ParseIntError, ParseFloatError, TryFromIntError}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::num::Wrapping; -- cgit 1.4.1-3-g733a5