Skip to content

Commit

Permalink
Auto merge of rust-lang#89450 - usbalbin:const_try_revert, r=oli-obk
Browse files Browse the repository at this point in the history
Revert rust-lang#86853

Should fix issue found in rust-lang#89432
  • Loading branch information
bors committed Oct 2, 2021
2 parents 6e12110 + 6a0c97a commit a8387ae
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 58 deletions.
8 changes: 3 additions & 5 deletions library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,9 @@ where

// From implies Into
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
impl<T, U> const Into<U> for T
impl<T, U> Into<U> for T
where
U: ~const From<T>,
U: From<T>,
{
fn into(self) -> U {
U::from(self)
Expand All @@ -544,8 +543,7 @@ where

// From (and thus Into) is reflexive
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
impl<T> const From<T> for T {
impl<T> From<T> for T {
fn from(t: T) -> T {
t
}
Expand Down
1 change: 0 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
#![feature(const_heap)]
#![feature(const_convert)]
#![feature(const_inherent_unchecked_arith)]
#![feature(const_int_unchecked_arith)]
#![feature(const_intrinsic_copy)]
Expand Down
6 changes: 2 additions & 4 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2019,8 +2019,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
}

#[unstable(feature = "try_trait_v2", issue = "84277")]
#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
impl<T> const ops::Try for Option<T> {
impl<T> ops::Try for Option<T> {
type Output = T;
type Residual = Option<convert::Infallible>;

Expand All @@ -2039,8 +2038,7 @@ impl<T> const ops::Try for Option<T> {
}

#[unstable(feature = "try_trait_v2", issue = "84277")]
#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
impl<T> const ops::FromResidual for Option<T> {
impl<T> ops::FromResidual for Option<T> {
#[inline]
fn from_residual(residual: Option<convert::Infallible>) -> Self {
match residual {
Expand Down
8 changes: 2 additions & 6 deletions library/core/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1889,8 +1889,7 @@ impl<A, E, V: FromIterator<A>> FromIterator<Result<A, E>> for Result<V, E> {
}

#[unstable(feature = "try_trait_v2", issue = "84277")]
#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
impl<T, E> const ops::Try for Result<T, E> {
impl<T, E> ops::Try for Result<T, E> {
type Output = T;
type Residual = Result<convert::Infallible, E>;

Expand All @@ -1909,10 +1908,7 @@ impl<T, E> const ops::Try for Result<T, E> {
}

#[unstable(feature = "try_trait_v2", issue = "84277")]
#[rustc_const_unstable(feature = "const_convert", issue = "88674")]
impl<T, E, F: ~const From<E>> const ops::FromResidual<Result<convert::Infallible, E>>
for Result<T, F>
{
impl<T, E, F: From<E>> ops::FromResidual<Result<convert::Infallible, E>> for Result<T, F> {
#[inline]
fn from_residual(residual: Result<convert::Infallible, E>) -> Self {
match residual {
Expand Down
16 changes: 0 additions & 16 deletions library/core/tests/convert.rs

This file was deleted.

4 changes: 1 addition & 3 deletions library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
#![feature(cfg_target_has_atomic)]
#![feature(const_assume)]
#![feature(const_cell_into_inner)]
#![feature(const_convert)]
#![feature(const_maybe_uninit_assume_init)]
#![feature(const_num_from_num)]
#![feature(const_ptr_read)]
#![feature(const_ptr_write)]
#![feature(const_ptr_offset)]
#![feature(const_trait_impl)]
#![feature(const_num_from_num)]
#![feature(core_intrinsics)]
#![feature(core_private_bignum)]
#![feature(core_private_diy_float)]
Expand Down Expand Up @@ -84,7 +83,6 @@ mod char;
mod clone;
mod cmp;
mod const_ptr;
mod convert;
mod fmt;
mod hash;
mod intrinsics;
Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/consts/not_const_clusure_in_const.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// run-pass

const _FOO: fn() -> String = || "foo".into();

pub fn bar() -> fn() -> String {
|| "bar".into()
}

fn main(){}
23 changes: 0 additions & 23 deletions src/test/ui/consts/try-operator.rs

This file was deleted.

0 comments on commit a8387ae

Please sign in to comment.