Skip to content

Commit a1990db

Browse files
committed
Remove a bunch of dead functions and make some functions private
1 parent 23b0c47 commit a1990db

File tree

2 files changed

+3
-37
lines changed

2 files changed

+3
-37
lines changed

src/librustc_mir/interpret/operand.rs

-24
Original file line numberDiff line numberDiff line change
@@ -153,30 +153,6 @@ pub enum Operand<Tag = (), Id = AllocId> {
153153
Indirect(MemPlace<Tag, Id>),
154154
}
155155

156-
impl<Tag> Operand<Tag> {
157-
#[inline]
158-
pub fn assert_mem_place(self) -> MemPlace<Tag>
159-
where
160-
Tag: ::std::fmt::Debug,
161-
{
162-
match self {
163-
Operand::Indirect(mplace) => mplace,
164-
_ => bug!("assert_mem_place: expected Operand::Indirect, got {:?}", self),
165-
}
166-
}
167-
168-
#[inline]
169-
pub fn assert_immediate(self) -> Immediate<Tag>
170-
where
171-
Tag: ::std::fmt::Debug,
172-
{
173-
match self {
174-
Operand::Immediate(imm) => imm,
175-
_ => bug!("assert_immediate: expected Operand::Immediate, got {:?}", self),
176-
}
177-
}
178-
}
179-
180156
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
181157
pub struct OpTy<'tcx, Tag = ()> {
182158
op: Operand<Tag>, // Keep this private; it helps enforce invariants.

src/librustc_mir/interpret/place.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ impl<Tag> MemPlace<Tag> {
131131
}
132132

133133
#[inline(always)]
134-
pub fn from_scalar_ptr(ptr: Scalar<Tag>, align: Align) -> Self {
134+
fn from_scalar_ptr(ptr: Scalar<Tag>, align: Align) -> Self {
135135
MemPlace { ptr, align, meta: MemPlaceMeta::None }
136136
}
137137

138138
/// Produces a Place that will error if attempted to be read from or written to
139139
#[inline(always)]
140-
pub fn null(cx: &impl HasDataLayout) -> Self {
140+
fn null(cx: &impl HasDataLayout) -> Self {
141141
Self::from_scalar_ptr(Scalar::ptr_null(cx), Align::from_bytes(1).unwrap())
142142
}
143143

@@ -263,20 +263,10 @@ impl<'tcx, Tag: ::std::fmt::Debug + Copy> OpTy<'tcx, Tag> {
263263
impl<Tag: ::std::fmt::Debug> Place<Tag> {
264264
/// Produces a Place that will error if attempted to be read from or written to
265265
#[inline(always)]
266-
pub fn null(cx: &impl HasDataLayout) -> Self {
266+
fn null(cx: &impl HasDataLayout) -> Self {
267267
Place::Ptr(MemPlace::null(cx))
268268
}
269269

270-
#[inline(always)]
271-
pub fn from_scalar_ptr(ptr: Scalar<Tag>, align: Align) -> Self {
272-
Place::Ptr(MemPlace::from_scalar_ptr(ptr, align))
273-
}
274-
275-
#[inline(always)]
276-
pub fn from_ptr(ptr: Pointer<Tag>, align: Align) -> Self {
277-
Place::Ptr(MemPlace::from_ptr(ptr, align))
278-
}
279-
280270
#[inline]
281271
pub fn assert_mem_place(self) -> MemPlace<Tag> {
282272
match self {

0 commit comments

Comments
 (0)