summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2017-10-10 11:35:41 -0700
committerJosh Stone <jistone@redhat.com>2017-10-10 11:35:41 -0700
commit604f049cd5060129cf14f7bd340d442811345ea8 (patch)
tree63f8e90d66dc57fbae77142dc618feb61236fbf2 /src/libcore/tests
parent40a678d8dbaea49a2e9f5451f4db68359a09f67a (diff)
downloadrust-604f049cd5060129cf14f7bd340d442811345ea8.tar.gz
rust-604f049cd5060129cf14f7bd340d442811345ea8.zip
Restore `T: Sized` on `ptr::is_null`
The exact semantics of `is_null` on unsized pointers are still debatable,
especially for trait objects.  It may be legal to call `*mut self`
methods on a trait object someday, as with Go interfaces, so `is_null`
might need to validate the vtable pointer too.

For `as_ref` and `as_mut`, we're assuming that you cannot have a non-null
data pointer with a null vtable, so casting the unsized check is fine.
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/ptr.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/libcore/tests/ptr.rs b/src/libcore/tests/ptr.rs
index 98436f0e1d1..e93e9be0cd5 100644
--- a/src/libcore/tests/ptr.rs
+++ b/src/libcore/tests/ptr.rs
@@ -62,39 +62,6 @@ fn test_is_null() {
 
     let mq = unsafe { mp.offset(1) };
     assert!(!mq.is_null());
-
-    // Pointers to unsized types -- slices
-    let s: &mut [u8] = &mut [1, 2, 3];
-    let cs: *const [u8] = s;
-    assert!(!cs.is_null());
-
-    let ms: *mut [u8] = s;
-    assert!(!ms.is_null());
-
-    let cz: *const [u8] = &[];
-    assert!(!cz.is_null());
-
-    let mz: *mut [u8] = &mut [];
-    assert!(!mz.is_null());
-
-    let ncs: *const [u8] = null::<[u8; 3]>();
-    assert!(ncs.is_null());
-
-    let nms: *mut [u8] = null_mut::<[u8; 3]>();
-    assert!(nms.is_null());
-
-    // Pointers to unsized types -- trait objects
-    let ci: *const ToString = &3;
-    assert!(!ci.is_null());
-
-    let mi: *mut ToString = &mut 3;
-    assert!(!mi.is_null());
-
-    let nci: *const ToString = null::<isize>();
-    assert!(nci.is_null());
-
-    let nmi: *mut ToString = null_mut::<isize>();
-    assert!(nmi.is_null());
 }
 
 #[test]