Skip to content

Commit d8cd933

Browse files
pnkfelixalexcrichton
authored andcommitted
Revert "Stabilize the TryFrom and TryInto traits"
This reverts commit e53a2a7.
1 parent e7c614b commit d8cd933

File tree

10 files changed

+27
-27
lines changed

10 files changed

+27
-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.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl FromStr for char {
265265
}
266266

267267

268-
#[stable(feature = "try_from", since = "1.26.0")]
268+
#[unstable(feature = "try_from", issue = "33417")]
269269
impl TryFrom<u32> for char {
270270
type Error = CharTryFromError;
271271

@@ -280,11 +280,11 @@ impl TryFrom<u32> for char {
280280
}
281281

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

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

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
@@ -3663,7 +3663,7 @@ macro_rules! from_str_radix_int_impl {
36633663
from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }
36643664

36653665
/// The error type returned when a checked integral type conversion fails.
3666-
#[stable(feature = "try_from", since = "1.26.0")]
3666+
#[unstable(feature = "try_from", issue = "33417")]
36673667
#[derive(Debug, Copy, Clone)]
36683668
pub struct TryFromIntError(());
36693669

@@ -3678,14 +3678,14 @@ impl TryFromIntError {
36783678
}
36793679
}
36803680

3681-
#[stable(feature = "try_from", since = "1.26.0")]
3681+
#[unstable(feature = "try_from", issue = "33417")]
36823682
impl fmt::Display for TryFromIntError {
36833683
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
36843684
self.__description().fmt(fmt)
36853685
}
36863686
}
36873687

3688-
#[stable(feature = "try_from", since = "1.26.0")]
3688+
#[unstable(feature = "try_from", issue = "33417")]
36893689
impl From<!> for TryFromIntError {
36903690
fn from(never: !) -> TryFromIntError {
36913691
never
@@ -3695,7 +3695,7 @@ impl From<!> for TryFromIntError {
36953695
// only negative bounds
36963696
macro_rules! try_from_lower_bounded {
36973697
($source:ty, $($target:ty),*) => {$(
3698-
#[stable(feature = "try_from", since = "1.26.0")]
3698+
#[unstable(feature = "try_from", issue = "33417")]
36993699
impl TryFrom<$source> for $target {
37003700
type Error = TryFromIntError;
37013701

@@ -3714,7 +3714,7 @@ macro_rules! try_from_lower_bounded {
37143714
// unsigned to signed (only positive bound)
37153715
macro_rules! try_from_upper_bounded {
37163716
($source:ty, $($target:ty),*) => {$(
3717-
#[stable(feature = "try_from", since = "1.26.0")]
3717+
#[unstable(feature = "try_from", issue = "33417")]
37183718
impl TryFrom<$source> for $target {
37193719
type Error = TryFromIntError;
37203720

@@ -3733,7 +3733,7 @@ macro_rules! try_from_upper_bounded {
37333733
// all other cases
37343734
macro_rules! try_from_both_bounded {
37353735
($source:ty, $($target:ty),*) => {$(
3736-
#[stable(feature = "try_from", since = "1.26.0")]
3736+
#[unstable(feature = "try_from", issue = "33417")]
37373737
impl TryFrom<$source> for $target {
37383738
type Error = TryFromIntError;
37393739

src/libcore/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#![feature(step_trait)]
4444
#![feature(test)]
4545
#![feature(trusted_len)]
46+
#![feature(try_from)]
4647
#![feature(try_trait)]
4748
#![feature(exact_chunks)]
4849
#![feature(atomic_nand)]

src/librustc_apfloat/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
#![cfg_attr(stage0, feature(slice_patterns))]
5050
#![cfg_attr(stage0, feature(i128_type))]
51-
#![cfg_attr(stage0, feature(try_from))]
51+
#![feature(try_from)]
5252

5353
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
5454
#[allow(unused_extern_crates)]

src/libstd/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,14 @@ impl Error for num::ParseIntError {
275275
}
276276
}
277277

278-
#[stable(feature = "try_from", since = "1.26.0")]
278+
#[unstable(feature = "try_from", issue = "33417")]
279279
impl Error for num::TryFromIntError {
280280
fn description(&self) -> &str {
281281
self.__description()
282282
}
283283
}
284284

285-
#[stable(feature = "try_from", since = "1.26.0")]
285+
#[unstable(feature = "try_from", issue = "33417")]
286286
impl Error for array::TryFromSliceError {
287287
fn description(&self) -> &str {
288288
self.__description()
@@ -356,7 +356,7 @@ impl Error for cell::BorrowMutError {
356356
}
357357
}
358358

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

src/libstd/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@
312312
#![feature(test, rustc_private)]
313313
#![feature(thread_local)]
314314
#![feature(toowned_clone_into)]
315+
#![feature(try_from)]
315316
#![feature(try_reserve)]
316317
#![feature(unboxed_closures)]
317318
#![feature(unicode)]

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)