From f6faf0b2e725b2ba638acc61501df2b88597b271 Mon Sep 17 00:00:00 2001 From: jumbatm <30644300+jumbatm@users.noreply.github.com> Date: Fri, 27 Dec 2019 11:59:55 +1000 Subject: [PATCH] Clean up const-hack from #63810 --- src/libcore/lib.rs | 2 ++ src/libcore/ptr/const_ptr.rs | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 7d11dd2800fd4..590f4e46c1d2f 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -71,6 +71,8 @@ #![feature(cfg_target_has_atomic)] #![feature(concat_idents)] #![feature(const_fn)] +#![feature(const_if_match)] +#![feature(const_panic)] #![feature(const_fn_union)] #![feature(const_generics)] #![feature(const_ptr_offset_from)] diff --git a/src/libcore/ptr/const_ptr.rs b/src/libcore/ptr/const_ptr.rs index e5297a0c1e094..fc3c02e1f066d 100644 --- a/src/libcore/ptr/const_ptr.rs +++ b/src/libcore/ptr/const_ptr.rs @@ -288,10 +288,7 @@ impl *const T { T: Sized, { let pointee_size = mem::size_of::(); - let ok = 0 < pointee_size && pointee_size <= isize::max_value() as usize; - // assert that the pointee size is valid in a const eval compatible way - // FIXME: do this with a real assert at some point - [()][(!ok) as usize]; + assert!(0 < pointee_size && pointee_size <= isize::max_value() as usize); intrinsics::ptr_offset_from(self, origin) }