Remove intrinsics::arith_offset use from libarena

The use of arith_offset was added in 803e9ae67b
before the stable wrapper of the intrinsic was available.

https://doc.rust-lang.org/stable/std/intrinsics/fn.arith_offset.html
This commit is contained in:
est31 2020-09-17 06:12:40 +02:00
parent 285fc7d704
commit b479139620

View file

@ -11,7 +11,6 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
test(no_crate_inject, attr(deny(warnings)))
)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(raw_vec_internals)]
#![cfg_attr(test, feature(test))]
@ -25,7 +24,6 @@ use smallvec::SmallVec;
use std::alloc::Layout;
use std::cell::{Cell, RefCell};
use std::cmp;
use std::intrinsics;
use std::marker::{PhantomData, Send};
use std::mem;
use std::ptr;
@ -130,7 +128,7 @@ impl<T> TypedArena<T> {
unsafe {
if mem::size_of::<T>() == 0 {
self.ptr.set(intrinsics::arith_offset(self.ptr.get() as *mut u8, 1) as *mut T);
self.ptr.set((self.ptr.get() as *mut u8).wrapping_offset(1) as *mut T);
let ptr = mem::align_of::<T>() as *mut T;
// Don't drop the object. This `write` is equivalent to `forget`.
ptr::write(ptr, object);