about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-10-25 14:31:24 +0200
committerGitHub <noreply@github.com>2018-10-25 14:31:24 +0200
commit5443f7b017eb2e8cbb259094c2b3f0d95911c7ea (patch)
treecd59a07265f79bb895b8dfbde64d6edd90f9ece1
parent83906ec6adcb839f79099a33d739b44f5b694b6a (diff)
parentcbe6b2298a83e70b06498d1d623b3f15c645e1f8 (diff)
downloadrust-5443f7b017eb2e8cbb259094c2b3f0d95911c7ea.tar.gz
rust-5443f7b017eb2e8cbb259094c2b3f0d95911c7ea.zip
Rollup merge of #55345 - RalfJung:no-null, r=oli-obk
Remove is_null

It was confusingly named (`is_zero` would have been better, as someone pointed out somewhere but I forgot who or where), and it didn't even reliably test for "is this value 0 at run-time" because out-of-bounds pointers *can* be 0.

It's not used in rustc, and miri only really needs `is_null_ptr` and `to_bytes() == 0`, so let's just kill this method.

r? @oli-obk
-rw-r--r--src/librustc/mir/interpret/value.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs
index 9e54b146fd0..4304f08a78f 100644
--- a/src/librustc/mir/interpret/value.rs
+++ b/src/librustc/mir/interpret/value.rs
@@ -181,7 +181,7 @@ impl<'tcx, Tag> Scalar<Tag> {
     #[inline]
     pub fn is_null_ptr(self, cx: impl HasDataLayout) -> bool {
         match self {
-            Scalar::Bits { bits, size } =>  {
+            Scalar::Bits { bits, size } => {
                 assert_eq!(size as u64, cx.data_layout().pointer_size.bytes());
                 bits == 0
             },
@@ -190,14 +190,6 @@ impl<'tcx, Tag> Scalar<Tag> {
     }
 
     #[inline]
-    pub fn is_null(self) -> bool {
-        match self {
-            Scalar::Bits { bits, .. } => bits == 0,
-            Scalar::Ptr(_) => false
-        }
-    }
-
-    #[inline]
     pub fn from_bool(b: bool) -> Self {
         Scalar::Bits { bits: b as u128, size: 1 }
     }