Skip to content

Commit 58dcd1c

Browse files
committed
use the new Box methods in the interpreter
1 parent 6eaf531 commit 58dcd1c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

compiler/rustc_middle/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#![feature(allocator_api)]
3535
#![feature(array_windows)]
3636
#![feature(assert_matches)]
37+
#![feature(box_as_ptr)]
3738
#![feature(box_patterns)]
3839
#![feature(closure_track_caller)]
3940
#![feature(const_option)]

compiler/rustc_middle/src/mir/interpret/allocation.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@ impl AllocBytes for Box<[u8]> {
6262
}
6363

6464
fn as_mut_ptr(&mut self) -> *mut u8 {
65-
// Carefully avoiding any intermediate references.
66-
ptr::addr_of_mut!(**self).cast()
65+
Box::as_mut_ptr(self).cast()
6766
}
6867

6968
fn as_ptr(&self) -> *const u8 {
70-
// Carefully avoiding any intermediate references.
71-
ptr::addr_of!(**self).cast()
69+
Box::as_ptr(self).cast()
7270
}
7371
}
7472

0 commit comments

Comments
 (0)