diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-12-27 00:58:48 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-01-07 15:41:48 +0100 |
| commit | a1990db7c68ead195d1ddf4b245e3c0e6f721fbc (patch) | |
| tree | 5d104521da5b4321a771d82f905f9e2c90cf0b9e | |
| parent | 23b0c470244e612206486bb51f687ef4f6b6e117 (diff) | |
Remove a bunch of dead functions and make some functions private
| -rw-r--r-- | src/librustc_mir/interpret/operand.rs | 24 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/place.rs | 16 |
2 files changed, 3 insertions, 37 deletions
diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 00aecf74c7d..ddd9776e893 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -153,30 +153,6 @@ pub enum Operand<Tag = (), Id = AllocId> { Indirect(MemPlace<Tag, Id>), } -impl<Tag> Operand<Tag> { - #[inline] - pub fn assert_mem_place(self) -> MemPlace<Tag> - where - Tag: ::std::fmt::Debug, - { - match self { - Operand::Indirect(mplace) => mplace, - _ => bug!("assert_mem_place: expected Operand::Indirect, got {:?}", self), - } - } - - #[inline] - pub fn assert_immediate(self) -> Immediate<Tag> - where - Tag: ::std::fmt::Debug, - { - match self { - Operand::Immediate(imm) => imm, - _ => bug!("assert_immediate: expected Operand::Immediate, got {:?}", self), - } - } -} - #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct OpTy<'tcx, Tag = ()> { op: Operand<Tag>, // Keep this private; it helps enforce invariants. diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 6d848092def..f5e8d052b21 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -131,13 +131,13 @@ impl<Tag> MemPlace<Tag> { } #[inline(always)] - pub fn from_scalar_ptr(ptr: Scalar<Tag>, align: Align) -> Self { + fn from_scalar_ptr(ptr: Scalar<Tag>, align: Align) -> Self { MemPlace { ptr, align, meta: MemPlaceMeta::None } } /// Produces a Place that will error if attempted to be read from or written to #[inline(always)] - pub fn null(cx: &impl HasDataLayout) -> Self { + fn null(cx: &impl HasDataLayout) -> Self { Self::from_scalar_ptr(Scalar::ptr_null(cx), Align::from_bytes(1).unwrap()) } @@ -263,20 +263,10 @@ impl<'tcx, Tag: ::std::fmt::Debug + Copy> OpTy<'tcx, Tag> { impl<Tag: ::std::fmt::Debug> Place<Tag> { /// Produces a Place that will error if attempted to be read from or written to #[inline(always)] - pub fn null(cx: &impl HasDataLayout) -> Self { + fn null(cx: &impl HasDataLayout) -> Self { Place::Ptr(MemPlace::null(cx)) } - #[inline(always)] - pub fn from_scalar_ptr(ptr: Scalar<Tag>, align: Align) -> Self { - Place::Ptr(MemPlace::from_scalar_ptr(ptr, align)) - } - - #[inline(always)] - pub fn from_ptr(ptr: Pointer<Tag>, align: Align) -> Self { - Place::Ptr(MemPlace::from_ptr(ptr, align)) - } - #[inline] pub fn assert_mem_place(self) -> MemPlace<Tag> { match self { |
