]> git.lizzy.rs Git - rust.git/commitdiff
Constify identify conversions
authorAlbin Hedman <albin9604@gmail.com>
Sat, 3 Jul 2021 22:13:27 +0000 (00:13 +0200)
committerAlbin Hedman <albin9604@gmail.com>
Wed, 15 Sep 2021 14:57:58 +0000 (16:57 +0200)
library/core/src/convert/mod.rs
library/core/src/lib.rs

index 1e512af48051ed9dc7c5627ed29aef8b0906506f..78d37ebac2d0c80651dd454fd45141394319d276 100644 (file)
@@ -532,7 +532,8 @@ fn as_mut(&mut self) -> &mut U {
 
 // From implies Into
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T, U> Into<U> for T
+#[rustc_const_unstable(feature = "const_convert", issue = "none")]
+impl<T, U> const Into<U> for T
 where
     U: From<T>,
 {
@@ -543,7 +544,8 @@ fn into(self) -> U {
 
 // From (and thus Into) is reflexive
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> From<T> for T {
+#[rustc_const_unstable(feature = "const_convert", issue = "none")]
+impl<T> const From<T> for T {
     fn from(t: T) -> T {
         t
     }
index 265ba9f1bb91b69d1fc9c2b162b4a18a03db34d9..9c4429d320f1ff05e5772981617fc7005d5bcea0 100644 (file)
@@ -82,6 +82,7 @@
 #![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)]