Skip to content

Commit 96f8f99

Browse files
rustc_abi: remove Primitive::{is_float,is_int}
there were fixmes for this already i am about to remove is_ptr (since callers need to properly distinguish between pointers in different address spaces), so might as well do this at the same time
1 parent a5fa99e commit 96f8f99

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

compiler/rustc_abi/src/lib.rs

-12
Original file line numberDiff line numberDiff line change
@@ -887,18 +887,6 @@ impl Primitive {
887887
}
888888
}
889889

890-
// FIXME(eddyb) remove, it's trivial thanks to `matches!`.
891-
#[inline]
892-
pub fn is_float(self) -> bool {
893-
matches!(self, F32 | F64)
894-
}
895-
896-
// FIXME(eddyb) remove, it's completely unused.
897-
#[inline]
898-
pub fn is_int(self) -> bool {
899-
matches!(self, Int(..))
900-
}
901-
902890
#[inline]
903891
pub fn is_ptr(self) -> bool {
904892
matches!(self, Pointer)

compiler/rustc_target/src/abi/call/sparc64.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ where
2020
{
2121
let dl = cx.data_layout();
2222

23-
if !scalar.primitive().is_float() {
23+
if !matches!(scalar.primitive(), abi::F32 | abi::F64) {
2424
return data;
2525
}
2626

@@ -87,7 +87,7 @@ where
8787
_ => {}
8888
}
8989

90-
if (offset.bytes() % 4) != 0 && scalar2.primitive().is_float() {
90+
if (offset.bytes() % 4) != 0 && matches!(scalar2.primitive(), abi::F32 | abi::F64) {
9191
offset += Size::from_bytes(4 - (offset.bytes() % 4));
9292
}
9393
data = arg_scalar(cx, scalar2, offset, data);

compiler/rustc_target/src/abi/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
129129
C: HasDataLayout,
130130
{
131131
match self.abi {
132-
Abi::Scalar(scalar) => scalar.primitive().is_float(),
132+
Abi::Scalar(scalar) => matches!(scalar.primitive(), F32 | F64),
133133
Abi::Aggregate { .. } => {
134134
if self.fields.count() == 1 && self.fields.offset(0).bytes() == 0 {
135135
self.field(cx, 0).is_single_fp_element(cx)

0 commit comments

Comments
 (0)