diff options
| author | Albin Hedman <albin9604@gmail.com> | 2020-12-02 21:07:40 +0100 |
|---|---|---|
| committer | Albin Hedman <albin9604@gmail.com> | 2020-12-02 21:07:40 +0100 |
| commit | 4f9fd2a5d45a0ea0c49a3a78f8f1c8e091b9c604 (patch) | |
| tree | b24b56eb66ad56d4dd006a8dd6869d9ab1977b98 | |
| parent | f311db100ba338d13a6f590288e027623a8e9434 (diff) | |
| download | rust-4f9fd2a5d45a0ea0c49a3a78f8f1c8e091b9c604.tar.gz rust-4f9fd2a5d45a0ea0c49a3a78f8f1c8e091b9c604.zip | |
Undo fn -> const fn for all intrinsics but assert_inhabited
| -rw-r--r-- | compiler/rustc_mir/src/interpret/intrinsics.rs | 18 | ||||
| -rw-r--r-- | library/core/src/intrinsics.rs | 2 |
2 files changed, 1 insertions, 19 deletions
diff --git a/compiler/rustc_mir/src/interpret/intrinsics.rs b/compiler/rustc_mir/src/interpret/intrinsics.rs index c751f4f7eb6..90018673e1a 100644 --- a/compiler/rustc_mir/src/interpret/intrinsics.rs +++ b/compiler/rustc_mir/src/interpret/intrinsics.rs @@ -407,29 +407,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { sym::transmute => { self.copy_op_transmute(args[0], dest)?; } - sym::assert_inhabited | sym::assert_zero_valid | sym::assert_uninit_valid => { + sym::assert_inhabited => { let ty = instance.substs.type_at(0); let layout = self.layout_of(ty)?; if layout.abi.is_uninhabited() { throw_ub_format!("attempted to instantiate uninhabited type `{}`", ty); } - if intrinsic_name == sym::assert_zero_valid - && !layout.might_permit_raw_init(self, /*zero:*/ true).unwrap() - { - throw_ub_format!( - "attempted to zero-initialize type `{}`, which is invalid", - ty - ); - } - if intrinsic_name == sym::assert_uninit_valid - && !layout.might_permit_raw_init(self, /*zero:*/ false).unwrap() - { - throw_ub_format!( - "attempted to leave type `{}` uninitialized, which is invalid", - ty - ); - } } sym::simd_insert => { let index = u64::from(self.read_scalar(args[1])?.to_u32()?); diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 0c37bec4698..ac31476f227 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -822,14 +822,12 @@ extern "rust-intrinsic" { /// zero-initialization: This will statically either panic, or do nothing. /// /// This intrinsic does not have a stable counterpart. - #[rustc_const_unstable(feature = "const_assert_type", issue = "none")] pub fn assert_zero_valid<T>(); /// A guard for unsafe functions that cannot ever be executed if `T` has invalid /// bit patterns: This will statically either panic, or do nothing. /// /// This intrinsic does not have a stable counterpart. - #[rustc_const_unstable(feature = "const_assert_type", issue = "none")] pub fn assert_uninit_valid<T>(); /// Gets a reference to a static `Location` indicating where it was called. |
