Skip to content

Commit

Permalink
Clean up const-hack from rust-lang#63810
Browse files Browse the repository at this point in the history
  • Loading branch information
jumbatm committed Dec 27, 2019
1 parent 8f5f8f9 commit f6faf0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
5 changes: 1 addition & 4 deletions src/libcore/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit f6faf0b

Please sign in to comment.