summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_arena/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_arena/src/lib.rs')
-rw-r--r--compiler/rustc_arena/src/lib.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs
index a5f1cbc96..46dbbd83d 100644
--- a/compiler/rustc_arena/src/lib.rs
+++ b/compiler/rustc_arena/src/lib.rs
@@ -16,10 +16,12 @@
#![feature(maybe_uninit_slice)]
#![feature(min_specialization)]
#![feature(decl_macro)]
+#![feature(pointer_byte_offsets)]
#![feature(rustc_attrs)]
#![cfg_attr(test, feature(test))]
#![feature(strict_provenance)]
-#![feature(ptr_const_cast)]
+#![deny(rustc::untranslatable_diagnostic)]
+#![deny(rustc::diagnostic_outside_of_impl)]
use smallvec::SmallVec;
@@ -210,7 +212,7 @@ impl<T> TypedArena<T> {
unsafe {
if mem::size_of::<T>() == 0 {
- self.ptr.set((self.ptr.get() as *mut u8).wrapping_offset(1) as *mut T);
+ self.ptr.set(self.ptr.get().wrapping_byte_add(1));
let ptr = ptr::NonNull::<T>::dangling().as_ptr();
// Don't drop the object. This `write` is equivalent to `forget`.
ptr::write(ptr, object);
@@ -218,7 +220,7 @@ impl<T> TypedArena<T> {
} else {
let ptr = self.ptr.get();
// Advance the pointer.
- self.ptr.set(self.ptr.get().offset(1));
+ self.ptr.set(self.ptr.get().add(1));
// Write into uninitialized memory.
ptr::write(ptr, object);
&mut *ptr