Skip to content

Commit d141fdc

Browse files
committed
Revert "Stabilize the TryFrom and TryInto traits"
This reverts commit e53a2a7.
1 parent aaefa94 commit d141fdc

File tree

11 files changed

+28
-27
lines changed

11 files changed

+28
-27
lines changed

src/libcore/array.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
5959
}
6060

6161
/// The error type returned when a conversion from a slice to an array fails.
62-
#[stable(feature = "try_from", since = "1.26.0")]
62+
#[unstable(feature = "try_from", issue = "33417")]
6363
#[derive(Debug, Copy, Clone)]
6464
pub struct TryFromSliceError(());
6565

@@ -148,7 +148,7 @@ macro_rules! array_impls {
148148
}
149149
}
150150

151-
#[stable(feature = "try_from", since = "1.26.0")]
151+
#[unstable(feature = "try_from", issue = "33417")]
152152
impl<'a, T> TryFrom<&'a [T]> for &'a [T; $N] {
153153
type Error = TryFromSliceError;
154154

@@ -162,7 +162,7 @@ macro_rules! array_impls {
162162
}
163163
}
164164

165-
#[stable(feature = "try_from", since = "1.26.0")]
165+
#[unstable(feature = "try_from", issue = "33417")]
166166
impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; $N] {
167167
type Error = TryFromSliceError;
168168

src/libcore/char/convert.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl FromStr for char {
204204
}
205205

206206

207-
#[stable(feature = "try_from", since = "1.26.0")]
207+
#[unstable(feature = "try_from", issue = "33417")]
208208
impl TryFrom<u32> for char {
209209
type Error = CharTryFromError;
210210

@@ -219,11 +219,11 @@ impl TryFrom<u32> for char {
219219
}
220220

221221
/// The error type returned when a conversion from u32 to char fails.
222-
#[stable(feature = "try_from", since = "1.26.0")]
222+
#[unstable(feature = "try_from", issue = "33417")]
223223
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
224224
pub struct CharTryFromError(());
225225

226-
#[stable(feature = "try_from", since = "1.26.0")]
226+
#[unstable(feature = "try_from", issue = "33417")]
227227
impl fmt::Display for CharTryFromError {
228228
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
229229
"converted integer out of range for `char`".fmt(f)

src/libcore/char/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub use self::convert::{from_u32, from_digit};
4040
pub use self::convert::from_u32_unchecked;
4141
#[stable(feature = "char_from_str", since = "1.20.0")]
4242
pub use self::convert::ParseCharError;
43-
#[stable(feature = "try_from", since = "1.26.0")]
43+
#[unstable(feature = "try_from", issue = "33417")]
4444
pub use self::convert::CharTryFromError;
4545
#[stable(feature = "decode_utf16", since = "1.9.0")]
4646
pub use self::decode::{decode_utf16, DecodeUtf16, DecodeUtf16Error};

src/libcore/convert.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -322,26 +322,22 @@ pub trait From<T>: Sized {
322322
///
323323
/// [`TryFrom`]: trait.TryFrom.html
324324
/// [`Into`]: trait.Into.html
325-
#[stable(feature = "try_from", since = "1.26.0")]
325+
#[unstable(feature = "try_from", issue = "33417")]
326326
pub trait TryInto<T>: Sized {
327327
/// The type returned in the event of a conversion error.
328-
#[stable(feature = "try_from", since = "1.26.0")]
329328
type Error;
330329

331330
/// Performs the conversion.
332-
#[stable(feature = "try_from", since = "1.26.0")]
333331
fn try_into(self) -> Result<T, Self::Error>;
334332
}
335333

336334
/// Attempt to construct `Self` via a conversion.
337-
#[stable(feature = "try_from", since = "1.26.0")]
335+
#[unstable(feature = "try_from", issue = "33417")]
338336
pub trait TryFrom<T>: Sized {
339337
/// The type returned in the event of a conversion error.
340-
#[stable(feature = "try_from", since = "1.26.0")]
341338
type Error;
342339

343340
/// Performs the conversion.
344-
#[stable(feature = "try_from", since = "1.26.0")]
345341
fn try_from(value: T) -> Result<Self, Self::Error>;
346342
}
347343

@@ -409,7 +405,7 @@ impl<T> From<T> for T {
409405

410406

411407
// TryFrom implies TryInto
412-
#[stable(feature = "try_from", since = "1.26.0")]
408+
#[unstable(feature = "try_from", issue = "33417")]
413409
impl<T, U> TryInto<U> for T where U: TryFrom<T>
414410
{
415411
type Error = U::Error;
@@ -421,7 +417,7 @@ impl<T, U> TryInto<U> for T where U: TryFrom<T>
421417

422418
// Infallible conversions are semantically equivalent to fallible conversions
423419
// with an uninhabited error type.
424-
#[stable(feature = "try_from", since = "1.26.0")]
420+
#[unstable(feature = "try_from", issue = "33417")]
425421
impl<T, U> TryFrom<U> for T where T: From<U> {
426422
type Error = !;
427423

src/libcore/num/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -4192,7 +4192,7 @@ macro_rules! from_str_radix_int_impl {
41924192
from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }
41934193

41944194
/// The error type returned when a checked integral type conversion fails.
4195-
#[stable(feature = "try_from", since = "1.26.0")]
4195+
#[unstable(feature = "try_from", issue = "33417")]
41964196
#[derive(Debug, Copy, Clone)]
41974197
pub struct TryFromIntError(());
41984198

@@ -4207,14 +4207,14 @@ impl TryFromIntError {
42074207
}
42084208
}
42094209

4210-
#[stable(feature = "try_from", since = "1.26.0")]
4210+
#[unstable(feature = "try_from", issue = "33417")]
42114211
impl fmt::Display for TryFromIntError {
42124212
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
42134213
self.__description().fmt(fmt)
42144214
}
42154215
}
42164216

4217-
#[stable(feature = "try_from", since = "1.26.0")]
4217+
#[unstable(feature = "try_from", issue = "33417")]
42184218
impl From<!> for TryFromIntError {
42194219
fn from(never: !) -> TryFromIntError {
42204220
never
@@ -4224,7 +4224,7 @@ impl From<!> for TryFromIntError {
42244224
// only negative bounds
42254225
macro_rules! try_from_lower_bounded {
42264226
($source:ty, $($target:ty),*) => {$(
4227-
#[stable(feature = "try_from", since = "1.26.0")]
4227+
#[unstable(feature = "try_from", issue = "33417")]
42284228
impl TryFrom<$source> for $target {
42294229
type Error = TryFromIntError;
42304230

@@ -4243,7 +4243,7 @@ macro_rules! try_from_lower_bounded {
42434243
// unsigned to signed (only positive bound)
42444244
macro_rules! try_from_upper_bounded {
42454245
($source:ty, $($target:ty),*) => {$(
4246-
#[stable(feature = "try_from", since = "1.26.0")]
4246+
#[unstable(feature = "try_from", issue = "33417")]
42474247
impl TryFrom<$source> for $target {
42484248
type Error = TryFromIntError;
42494249

@@ -4262,7 +4262,7 @@ macro_rules! try_from_upper_bounded {
42624262
// all other cases
42634263
macro_rules! try_from_both_bounded {
42644264
($source:ty, $($target:ty),*) => {$(
4265-
#[stable(feature = "try_from", since = "1.26.0")]
4265+
#[unstable(feature = "try_from", issue = "33417")]
42664266
impl TryFrom<$source> for $target {
42674267
type Error = TryFromIntError;
42684268

src/libcore/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#![feature(str_internals)]
3737
#![feature(test)]
3838
#![feature(trusted_len)]
39+
#![feature(try_from)]
3940
#![feature(try_trait)]
4041
#![feature(exact_chunks)]
4142
#![cfg_attr(stage0, feature(atomic_nand))]

src/librustc_apfloat/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
html_root_url = "https://doc.rust-lang.org/nightly/")]
4646
#![forbid(unsafe_code)]
4747

48+
#![feature(try_from)]
4849
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
4950
#[allow(unused_extern_crates)]
5051
extern crate rustc_cratesio_shim;

src/libstd/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,14 @@ impl Error for num::ParseIntError {
284284
}
285285
}
286286

287-
#[stable(feature = "try_from", since = "1.26.0")]
287+
#[unstable(feature = "try_from", issue = "33417")]
288288
impl Error for num::TryFromIntError {
289289
fn description(&self) -> &str {
290290
self.__description()
291291
}
292292
}
293293

294-
#[stable(feature = "try_from", since = "1.26.0")]
294+
#[unstable(feature = "try_from", issue = "33417")]
295295
impl Error for array::TryFromSliceError {
296296
fn description(&self) -> &str {
297297
self.__description()
@@ -365,7 +365,7 @@ impl Error for cell::BorrowMutError {
365365
}
366366
}
367367

368-
#[stable(feature = "try_from", since = "1.26.0")]
368+
#[unstable(feature = "try_from", issue = "33417")]
369369
impl Error for char::CharTryFromError {
370370
fn description(&self) -> &str {
371371
"converted integer out of range for `char`"

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@
307307
#![feature(test, rustc_private)]
308308
#![feature(thread_local)]
309309
#![feature(toowned_clone_into)]
310+
#![feature(try_from)]
310311
#![feature(try_reserve)]
311312
#![feature(unboxed_closures)]
312313
#![feature(untagged_unions)]

src/test/ui/e0119/conflict-with-std.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(try_from)]
12+
1113
use std::marker::PhantomData;
1214
use std::convert::{TryFrom, AsRef};
1315

src/test/ui/e0119/conflict-with-std.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0119]: conflicting implementations of trait `std::convert::AsRef<Q>` for type `std::boxed::Box<Q>`:
2-
--> $DIR/conflict-with-std.rs:15:1
2+
--> $DIR/conflict-with-std.rs:17:1
33
|
44
LL | impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
55
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -9,7 +9,7 @@ LL | impl AsRef<Q> for Box<Q> { //~ ERROR conflicting implementations
99
where T: ?Sized;
1010

1111
error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`:
12-
--> $DIR/conflict-with-std.rs:22:1
12+
--> $DIR/conflict-with-std.rs:24:1
1313
|
1414
LL | impl From<S> for S { //~ ERROR conflicting implementations
1515
| ^^^^^^^^^^^^^^^^^^
@@ -18,7 +18,7 @@ LL | impl From<S> for S { //~ ERROR conflicting implementations
1818
- impl<T> std::convert::From<T> for T;
1919

2020
error[E0119]: conflicting implementations of trait `std::convert::TryFrom<X>` for type `X`:
21-
--> $DIR/conflict-with-std.rs:29:1
21+
--> $DIR/conflict-with-std.rs:31:1
2222
|
2323
LL | impl TryFrom<X> for X { //~ ERROR conflicting implementations
2424
| ^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)