Commit Graph

8 Commits

Author SHA1 Message Date
Josh Stone
e0f58c6a11
Remove T: Sized on ptr::is_null()
This reverts commit 604f049cd5.

This is purely a revert of cuviper's revert "Restore `T: Sized` on
`ptr::is_null`". So double revert means this is code written by cuviper!
2017-11-19 00:33:56 -08:00
Josh Stone
604f049cd5 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.
2017-10-10 11:35:41 -07:00
Josh Stone
40a678d8db Use unsized coercions for null ptr tests 2017-09-30 14:45:18 -07:00
Josh Stone
8b2e09ffbb Avoid the UB of a null reference to a slice 2017-09-29 13:19:20 -07:00
Josh Stone
3580c4c589 Remove T: Sized on ptr::is_null(), as_ref(), as_mut()
`NonZero::is_zero()` was already casting all pointers to thin `*mut u8`
to check for null.  It seems reasonable to apply that for `is_null()` in
general, and then unsized fat pointers can also be used with `as_ref()`
and `as_mut()` to get fat references.
2017-09-29 12:36:32 -07:00
Simon Sapin
0a08ad0443 Rename {NonZero,Shared,Unique}::new to new_unchecked 2017-07-22 20:38:16 +02:00
Alexis Beingessner
4ff583b116 fallout from NonZero/Unique/Shared changes 2017-05-04 23:54:54 -04:00
Stjepan Glavina
13c744f30d Move libXtest into libX/tests
This change moves:

1. `libcoretest` into `libcore/tests`
2. `libcollectionstest` into `libcollections/tests`

This is a follow-up to #39561.
2017-04-03 20:49:39 +02:00