about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-11 08:53:06 -0700
committerGitHub <noreply@github.com>2020-07-11 08:53:06 -0700
commit90f1d724c8d9b364b4b0c81817484afa04c73009 (patch)
treefaeaf565f2045577edb5641c3cd091f25109219f /src/libcore
parent346aec9b02f3c74f3fce97fd6bda24709d220e49 (diff)
parentdd872be5da0887d800ae9a001ec212c7161f661c (diff)
Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJung
Stabilize `transmute` in constants and statics but not const fn

cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)

Previous attempt: #64011

r? @RalfJung

cc @rust-lang/wg-const-eval
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/intrinsics.rs4
-rw-r--r--src/libcore/lib.rs2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index b3e43cd7994..540a8cfb290 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -1285,7 +1285,9 @@ extern "rust-intrinsic" {
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[rustc_const_unstable(feature = "const_transmute", issue = "53605")]
+    // NOTE: While this makes the intrinsic const stable, we have some custom code in const fn
+    // checks that prevent its use within `const fn`.
+    #[rustc_const_stable(feature = "const_transmute", since = "1.46.0")]
     pub fn transmute<T, U>(e: T) -> U;
 
     /// Returns `true` if the actual type given as `T` requires drop
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 692d91bd61d..820c0a49e7f 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -140,7 +140,7 @@
 #![feature(rtm_target_feature)]
 #![feature(f16c_target_feature)]
 #![feature(hexagon_target_feature)]
-#![feature(const_transmute)]
+#![cfg_attr(not(bootstrap), feature(const_fn_transmute))]
 #![feature(abi_unadjusted)]
 #![feature(adx_target_feature)]
 #![feature(maybe_uninit_slice)]