about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjumbatm <30644300+jumbatm@users.noreply.github.com>2019-12-27 11:59:55 +1000
committerjumbatm <jumbatm@gmail.com>2019-12-27 23:21:27 +1000
commitf6faf0b2e725b2ba638acc61501df2b88597b271 (patch)
tree60e891cfd043de0f4bba1aa10c4c1bb4aeecf9bc
parent8f5f8f916f00f7989a4ebf7b7dbfe1afd605f828 (diff)
downloadrust-f6faf0b2e725b2ba638acc61501df2b88597b271.tar.gz
rust-f6faf0b2e725b2ba638acc61501df2b88597b271.zip
Clean up const-hack from #63810
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/ptr/const_ptr.rs5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 7d11dd2800f..590f4e46c1d 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 e5297a0c1e0..fc3c02e1f06 100644
--- a/src/libcore/ptr/const_ptr.rs
+++ b/src/libcore/ptr/const_ptr.rs
@@ -288,10 +288,7 @@ impl<T: ?Sized> *const T {
         T: Sized,
     {
         let pointee_size = mem::size_of::<T>();
-        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)
     }