Skip to content

Commit 1928d89

Browse files
committed
Constify identify conversions
1 parent 76d247c commit 1928d89

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

library/core/src/convert/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ where
532532

533533
// From implies Into
534534
#[stable(feature = "rust1", since = "1.0.0")]
535-
impl<T, U> Into<U> for T
535+
#[rustc_const_unstable(feature = "const_identity_convert", issue = "none")]
536+
impl<T, U> const Into<U> for T
536537
where
537538
U: From<T>,
538539
{
@@ -543,7 +544,8 @@ where
543544

544545
// From (and thus Into) is reflexive
545546
#[stable(feature = "rust1", since = "1.0.0")]
546-
impl<T> From<T> for T {
547+
#[rustc_const_unstable(feature = "const_identity_convert", issue = "none")]
548+
impl<T> const From<T> for T {
547549
fn from(t: T) -> T {
548550
t
549551
}

library/core/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@
105105
#![feature(const_size_of_val)]
106106
#![feature(const_swap)]
107107
#![feature(const_align_of_val)]
108+
#![allow(incomplete_features)] // FIXME: We very much probably want to remove this line whenever possible
109+
#![feature(const_trait_impl)]
110+
#![feature(const_identity_convert)]
108111
#![feature(const_type_id)]
109112
#![feature(const_type_name)]
110113
#![feature(const_likely)]

0 commit comments

Comments
 (0)