Skip to content

Commit 0efeae6

Browse files
committed
implicit_unsafe_autorefs: compiler fixes
1 parent 45a6283 commit 0efeae6

File tree

2 files changed

+6
-5
lines changed
  • compiler
    • rustc_arena/src
    • rustc_data_structures/src/owning_ref

2 files changed

+6
-5
lines changed

compiler/rustc_arena/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![feature(pointer_byte_offsets)]
2020
#![feature(rustc_attrs)]
2121
#![cfg_attr(test, feature(test))]
22+
#![feature(slice_ptr_len)]
2223
#![feature(strict_provenance)]
2324
#![deny(rustc::untranslatable_diagnostic)]
2425
#![deny(rustc::diagnostic_outside_of_impl)]
@@ -103,7 +104,7 @@ impl<T> ArenaChunk<T> {
103104
// A pointer as large as possible for zero-sized elements.
104105
ptr::invalid_mut(!0)
105106
} else {
106-
self.start().add((*self.storage.as_ptr()).len())
107+
self.start().add(self.storage.as_ptr().len())
107108
}
108109
}
109110
}
@@ -287,7 +288,7 @@ impl<T> TypedArena<T> {
287288
// If the previous chunk's len is less than HUGE_PAGE
288289
// bytes, then this chunk will be least double the previous
289290
// chunk's size.
290-
new_cap = (*last_chunk.storage.as_ptr()).len().min(HUGE_PAGE / elem_size / 2);
291+
new_cap = last_chunk.storage.as_ptr().len().min(HUGE_PAGE / elem_size / 2);
291292
new_cap *= 2;
292293
} else {
293294
new_cap = PAGE / elem_size;
@@ -395,7 +396,7 @@ impl DroplessArena {
395396
// If the previous chunk's len is less than HUGE_PAGE
396397
// bytes, then this chunk will be least double the previous
397398
// chunk's size.
398-
new_cap = (*last_chunk.storage.as_ptr()).len().min(HUGE_PAGE / 2);
399+
new_cap = last_chunk.storage.as_ptr().len().min(HUGE_PAGE / 2);
399400
new_cap *= 2;
400401
} else {
401402
new_cap = PAGE;

compiler/rustc_data_structures/src/owning_ref/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1105,14 +1105,14 @@ use std::sync::{MutexGuard, RwLockReadGuard, RwLockWriteGuard};
11051105
impl<T: 'static> ToHandle for RefCell<T> {
11061106
type Handle = Ref<'static, T>;
11071107
unsafe fn to_handle(x: *const Self) -> Self::Handle {
1108-
(*x).borrow()
1108+
(&*x).borrow()
11091109
}
11101110
}
11111111

11121112
impl<T: 'static> ToHandleMut for RefCell<T> {
11131113
type HandleMut = RefMut<'static, T>;
11141114
unsafe fn to_handle_mut(x: *const Self) -> Self::HandleMut {
1115-
(*x).borrow_mut()
1115+
(&*x).borrow_mut()
11161116
}
11171117
}
11181118

0 commit comments

Comments
 (0)