Skip to content

Commit e9ab099

Browse files
committed
get rid of to_ptr
1 parent f9644c1 commit e9ab099

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/librustc/mir/interpret/value.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,22 +406,14 @@ impl<'tcx, Tag> Scalar<Tag> {
406406
self.to_bits(target_size).expect("expected Raw bits but got a Pointer")
407407
}
408408

409-
/// Do not call this method! Use either `assert_ptr` or `force_ptr`.
410-
/// This method is intentionally private, do not make it public.
411409
#[inline]
412-
fn to_ptr(self) -> InterpResult<'tcx, Pointer<Tag>> {
410+
pub fn assert_ptr(self) -> Pointer<Tag> {
413411
match self {
414-
Scalar::Raw { data: 0, .. } => throw_unsup!(InvalidNullPointerUsage),
415-
Scalar::Raw { .. } => throw_unsup!(ReadBytesAsPointer),
416-
Scalar::Ptr(p) => Ok(p),
412+
Scalar::Ptr(p) => p,
413+
Scalar::Raw { .. } => bug!("expected a Pointer but got Raw bits")
417414
}
418415
}
419416

420-
#[inline(always)]
421-
pub fn assert_ptr(self) -> Pointer<Tag> {
422-
self.to_ptr().expect("expected a Pointer but got Raw bits")
423-
}
424-
425417
/// Do not call this method! Dispatch based on the type instead.
426418
#[inline]
427419
pub fn is_bits(self) -> bool {

0 commit comments

Comments
 (0)