Skip to content

Commit 8b50cc9

Browse files
committed
Auto merge of rust-lang#85769 - jhpratt:stabilize-const-transmute-union, r=RalfJung
Stabilize `const_fn_transmute`, `const_fn_union` This PR stabilizes the `const_fn_transmute` and `const_fn_union` features. It _does not_ stabilize any methods (obviously aside from `transmute`) that are blocked on only these features. Closes rust-lang#53605. Closes rust-lang#51909.
2 parents 2faabf5 + 37af399 commit 8b50cc9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+147
-535
lines changed

compiler/rustc_ast/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)]
1111
#![feature(box_syntax)]
1212
#![feature(box_patterns)]
13-
#![feature(const_fn_transmute)]
13+
#![cfg_attr(bootstrap, feature(const_fn_transmute))]
1414
#![feature(crate_visibility_modifier)]
1515
#![feature(iter_zip)]
1616
#![feature(label_break_value)]

compiler/rustc_feature/src/accepted.rs

+4
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ declare_features! (
290290
/// Allows bindings in the subpattern of a binding pattern.
291291
/// For example, you can write `x @ Some(y)`.
292292
(accepted, bindings_after_at, "1.54.0", Some(65490), None),
293+
/// Allows calling `transmute` in const fn
294+
(accepted, const_fn_transmute, "1.56.0", Some(53605), None),
295+
/// Allows accessing fields of unions inside `const` functions.
296+
(accepted, const_fn_union, "1.56.0", Some(51909), None),
293297

294298
// -------------------------------------------------------------------------
295299
// feature-group-end: accepted features

compiler/rustc_feature/src/active.rs

-6
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,6 @@ declare_features! (
413413
/// Allows inferring `'static` outlives requirements (RFC 2093).
414414
(active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
415415

416-
/// Allows accessing fields of unions inside `const` functions.
417-
(active, const_fn_union, "1.27.0", Some(51909), None),
418-
419416
/// Allows dereferencing raw pointers during const eval.
420417
(active, const_raw_ptr_deref, "1.27.0", Some(51911), None),
421418

@@ -565,9 +562,6 @@ declare_features! (
565562
/// Lazily evaluate constants. This allows constants to depend on type parameters.
566563
(incomplete, lazy_normalization_consts, "1.46.0", Some(72219), None),
567564

568-
/// Allows calling `transmute` in const fn
569-
(active, const_fn_transmute, "1.46.0", Some(53605), None),
570-
571565
/// Allows `if let` guard in match arms.
572566
(incomplete, if_let_guard, "1.47.0", Some(51114), None),
573567

compiler/rustc_mir/src/transform/check_consts/check.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -748,12 +748,7 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
748748
| ProjectionElem::Downcast(..)
749749
| ProjectionElem::Subslice { .. }
750750
| ProjectionElem::Field(..)
751-
| ProjectionElem::Index(_) => {
752-
let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
753-
if base_ty.is_union() {
754-
self.check_op(ops::UnionAccess);
755-
}
756-
}
751+
| ProjectionElem::Index(_) => {}
757752
}
758753
}
759754

@@ -876,15 +871,6 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
876871

877872
let is_intrinsic = tcx.fn_sig(callee).abi() == RustIntrinsic;
878873

879-
// HACK: This is to "unstabilize" the `transmute` intrinsic
880-
// within const fns. `transmute` is allowed in all other const contexts.
881-
// This won't really scale to more intrinsics or functions. Let's allow const
882-
// transmutes in const fn before we add more hacks to this.
883-
if is_intrinsic && tcx.item_name(callee) == sym::transmute {
884-
self.check_op(ops::Transmute);
885-
return;
886-
}
887-
888874
if !tcx.is_const_fn_raw(callee) {
889875
let mut permitted = false;
890876

compiler/rustc_mir/src/transform/check_consts/ops.rs

-45
Original file line numberDiff line numberDiff line change
@@ -501,51 +501,6 @@ impl NonConstOp for ThreadLocalAccess {
501501
}
502502
}
503503

504-
#[derive(Debug)]
505-
pub struct Transmute;
506-
impl NonConstOp for Transmute {
507-
fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {
508-
if ccx.const_kind() != hir::ConstContext::ConstFn {
509-
Status::Allowed
510-
} else {
511-
Status::Unstable(sym::const_fn_transmute)
512-
}
513-
}
514-
515-
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
516-
let mut err = feature_err(
517-
&ccx.tcx.sess.parse_sess,
518-
sym::const_fn_transmute,
519-
span,
520-
&format!("`transmute` is not allowed in {}s", ccx.const_kind()),
521-
);
522-
err.note("`transmute` is only allowed in constants and statics for now");
523-
err
524-
}
525-
}
526-
527-
#[derive(Debug)]
528-
pub struct UnionAccess;
529-
impl NonConstOp for UnionAccess {
530-
fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {
531-
// Union accesses are stable in all contexts except `const fn`.
532-
if ccx.const_kind() != hir::ConstContext::ConstFn {
533-
Status::Allowed
534-
} else {
535-
Status::Unstable(sym::const_fn_union)
536-
}
537-
}
538-
539-
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
540-
feature_err(
541-
&ccx.tcx.sess.parse_sess,
542-
sym::const_fn_union,
543-
span,
544-
"unions in const fn are unstable",
545-
)
546-
}
547-
}
548-
549504
// Types that cannot appear in the signature or locals of a `const fn`.
550505
pub mod ty {
551506
use super::*;

library/core/src/intrinsics.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,9 @@ extern "rust-intrinsic" {
911911
/// cause [undefined behavior][ub] with this function. `transmute` should be
912912
/// the absolute last resort.
913913
///
914+
/// Transmuting pointers to integers in a `const` context is [undefined behavior][ub].
915+
/// Any attempt to use the resulting value for integer operations will abort const-evaluation.
916+
///
914917
/// The [nomicon](../../nomicon/transmutes.html) has additional
915918
/// documentation.
916919
///
@@ -1128,8 +1131,6 @@ extern "rust-intrinsic" {
11281131
/// }
11291132
/// ```
11301133
#[stable(feature = "rust1", since = "1.0.0")]
1131-
// NOTE: While this makes the intrinsic const stable, we have some custom code in const fn
1132-
// checks that prevent its use within `const fn`.
11331134
#[rustc_const_stable(feature = "const_transmute", since = "1.46.0")]
11341135
#[rustc_diagnostic_item = "transmute"]
11351136
pub fn transmute<T, U>(e: T) -> U;

library/core/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#![feature(const_refs_to_cell)]
8787
#![feature(const_panic)]
8888
#![feature(const_pin)]
89-
#![feature(const_fn_union)]
89+
#![cfg_attr(bootstrap, feature(const_fn_union))]
9090
#![feature(const_impl_trait)]
9191
#![feature(const_fn_floating_point_arithmetic)]
9292
#![feature(const_fn_fn_ptr_basics)]
@@ -159,7 +159,7 @@
159159
#![feature(rtm_target_feature)]
160160
#![feature(f16c_target_feature)]
161161
#![feature(hexagon_target_feature)]
162-
#![feature(const_fn_transmute)]
162+
#![cfg_attr(bootstrap, feature(const_fn_transmute))]
163163
#![feature(abi_unadjusted)]
164164
#![feature(adx_target_feature)]
165165
#![feature(associated_type_bounds)]

library/core/src/num/int_macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,7 @@ macro_rules! int_impl {
20962096
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
20972097
// SAFETY: const sound because integers are plain old datatypes so we can always
20982098
// transmute them to arrays of bytes
2099-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
2099+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
21002100
#[inline]
21012101
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
21022102
// SAFETY: integers are plain old datatypes so we can always transmute them to
@@ -2202,7 +2202,7 @@ macro_rules! int_impl {
22022202
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
22032203
// SAFETY: const sound because integers are plain old datatypes so we can always
22042204
// transmute to them
2205-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
2205+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
22062206
#[inline]
22072207
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
22082208
// SAFETY: integers are plain old datatypes so we can always transmute to them

library/core/src/num/uint_macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ macro_rules! uint_impl {
19261926
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
19271927
// SAFETY: const sound because integers are plain old datatypes so we can always
19281928
// transmute them to arrays of bytes
1929-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
1929+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
19301930
#[inline]
19311931
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
19321932
// SAFETY: integers are plain old datatypes so we can always transmute them to
@@ -2032,7 +2032,7 @@ macro_rules! uint_impl {
20322032
#[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")]
20332033
// SAFETY: const sound because integers are plain old datatypes so we can always
20342034
// transmute to them
2035-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
2035+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
20362036
#[inline]
20372037
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
20382038
// SAFETY: integers are plain old datatypes so we can always transmute to them

library/core/src/slice/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<T> [T] {
100100
#[rustc_const_stable(feature = "const_slice_len", since = "1.39.0")]
101101
#[inline]
102102
// SAFETY: const sound because we transmute out the length field as a usize (which it must be)
103-
#[rustc_allow_const_fn_unstable(const_fn_union)]
103+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_union))]
104104
pub const fn len(&self) -> usize {
105105
// FIXME: Replace with `crate::ptr::metadata(self)` when that is const-stable.
106106
// As of this writing this causes a "Const-stable functions can only call other

library/core/src/str/converts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
157157
#[inline]
158158
#[stable(feature = "rust1", since = "1.0.0")]
159159
#[rustc_const_stable(feature = "const_str_from_utf8_unchecked", since = "1.55.0")]
160-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
160+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
161161
pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
162162
// SAFETY: the caller must guarantee that the bytes `v` are valid UTF-8.
163163
// Also relies on `&str` and `&[u8]` having the same layout.

library/core/src/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl str {
231231
#[rustc_const_stable(feature = "str_as_bytes", since = "1.39.0")]
232232
#[inline(always)]
233233
#[allow(unused_attributes)]
234-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
234+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
235235
pub const fn as_bytes(&self) -> &[u8] {
236236
// SAFETY: const sound because we transmute two types with the same layout
237237
unsafe { mem::transmute(self) }

library/std/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
#![feature(const_cstr_unchecked)]
247247
#![feature(const_fn_floating_point_arithmetic)]
248248
#![feature(const_fn_fn_ptr_basics)]
249-
#![feature(const_fn_transmute)]
249+
#![cfg_attr(bootstrap, feature(const_fn_transmute))]
250250
#![feature(const_io_structs)]
251251
#![feature(const_ip)]
252252
#![feature(const_ipv4)]

library/std/src/net/ip.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ impl Ipv6Addr {
10871087
///
10881088
/// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
10891089
/// ```
1090-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
1090+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
10911091
#[rustc_const_stable(feature = "const_ipv6", since = "1.32.0")]
10921092
#[stable(feature = "rust1", since = "1.0.0")]
10931093
#[inline]
@@ -1149,7 +1149,7 @@ impl Ipv6Addr {
11491149
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).segments(),
11501150
/// [0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff]);
11511151
/// ```
1152-
#[rustc_allow_const_fn_unstable(const_fn_transmute)]
1152+
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_fn_transmute))]
11531153
#[rustc_const_stable(feature = "const_ipv6", since = "1.50.0")]
11541154
#[stable(feature = "rust1", since = "1.0.0")]
11551155
#[inline]

src/test/mir-opt/issues/issue-75439.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff
22

3-
#![feature(const_fn_transmute)]
4-
53
use std::mem::transmute;
64

75
pub fn foo(bytes: [u8; 16]) -> Option<[u8; 4]> {
@@ -16,5 +14,5 @@ pub fn foo(bytes: [u8; 16]) -> Option<[u8; 4]> {
1614
}
1715

1816
fn main() {
19-
let _ = foo([0; 16]);
17+
let _ = foo([0; 16]);
2018
}

src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff

+39-39
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
+ // MIR for `foo` after MatchBranchSimplification
33

44
fn foo(_1: [u8; 16]) -> Option<[u8; 4]> {
5-
debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:7:12: 7:17
6-
let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:7:32: 7:47
7-
let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:9:9: 9:15
8-
let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:9:47: 9:52
9-
let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:12:14: 12:38
10-
let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:12:33: 12:35
5+
debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:5:12: 5:17
6+
let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:5:32: 5:47
7+
let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:7:9: 7:15
8+
let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:7:47: 7:52
9+
let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:10:14: 10:38
10+
let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:10:33: 10:35
1111
scope 1 {
12-
debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:9:9: 9:15
13-
let _4: u32; // in scope 1 at $DIR/issue-75439.rs:11:27: 11:29
12+
debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:7:9: 7:15
13+
let _4: u32; // in scope 1 at $DIR/issue-75439.rs:9:27: 9:29
1414
scope 3 {
15-
debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:11:27: 11:29
15+
debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29
1616
scope 4 {
1717
}
1818
}
@@ -21,67 +21,67 @@
2121
}
2222

2323
bb0: {
24-
StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:9:9: 9:15
25-
StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:9:47: 9:52
26-
_3 = _1; // scope 2 at $DIR/issue-75439.rs:9:47: 9:52
27-
_2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:9:37: 9:53
24+
StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:7:9: 7:15
25+
StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:7:47: 7:52
26+
_3 = _1; // scope 2 at $DIR/issue-75439.rs:7:47: 7:52
27+
_2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:7:37: 7:53
2828
// mir::Constant
29-
// + span: $DIR/issue-75439.rs:9:37: 9:46
29+
// + span: $DIR/issue-75439.rs:7:37: 7:46
3030
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn([u8; 16]) -> [u32; 4] {std::intrinsics::transmute::<[u8; 16], [u32; 4]>}, val: Value(Scalar(<ZST>)) }
3131
}
3232

3333
bb1: {
34-
StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:9:52: 9:53
35-
switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:13: 11:14
34+
StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53
35+
switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:9:13: 9:14
3636
}
3737

3838
bb2: {
39-
switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:16: 11:17
39+
switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:9:16: 9:17
4040
}
4141

4242
bb3: {
43-
switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:19: 11:20
43+
switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:9:19: 9:20
4444
}
4545

4646
bb4: {
47-
discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:14:9: 14:13
48-
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
47+
discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:12:9: 12:13
48+
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6
4949
}
5050

5151
bb5: {
52-
StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:12:14: 12:38
53-
StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:12:33: 12:35
54-
_6 = _4; // scope 4 at $DIR/issue-75439.rs:12:33: 12:35
55-
_5 = transmute::<u32, [u8; 4]>(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:12:23: 12:36
52+
StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:10:14: 10:38
53+
StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:10:33: 10:35
54+
_6 = _4; // scope 4 at $DIR/issue-75439.rs:10:33: 10:35
55+
_5 = transmute::<u32, [u8; 4]>(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:10:23: 10:36
5656
// mir::Constant
57-
// + span: $DIR/issue-75439.rs:12:23: 12:32
57+
// + span: $DIR/issue-75439.rs:10:23: 10:32
5858
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32) -> [u8; 4] {std::intrinsics::transmute::<u32, [u8; 4]>}, val: Value(Scalar(<ZST>)) }
5959
}
6060

6161
bb6: {
62-
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
63-
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
64-
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
62+
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29
63+
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29
64+
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6
6565
}
6666

6767
bb7: {
68-
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
69-
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
70-
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
68+
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29
69+
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29
70+
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6
7171
}
7272

7373
bb8: {
74-
StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:12:35: 12:36
75-
((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39
76-
discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39
77-
StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:12:38: 12:39
78-
StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:13:5: 13:6
79-
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
74+
StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:10:35: 10:36
75+
((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39
76+
discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39
77+
StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:10:38: 10:39
78+
StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:11:5: 11:6
79+
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6
8080
}
8181

8282
bb9: {
83-
StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:16:1: 16:2
84-
return; // scope 0 at $DIR/issue-75439.rs:16:2: 16:2
83+
StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:14:1: 14:2
84+
return; // scope 0 at $DIR/issue-75439.rs:14:2: 14:2
8585
}
8686
}
8787

src/test/ui/consts/const-eval/const_transmute.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

3-
#![feature(const_fn_union)]
43
#![allow(dead_code)]
54

65
#[repr(C)]

0 commit comments

Comments
 (0)