diff options
| author | Lzu Tao <taolzu@gmail.com> | 2019-06-17 10:52:37 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2019-06-17 10:52:46 +0000 |
| commit | 7d69d4ced23c446d6af341e3f9dc031a302150fc (patch) | |
| tree | 1d59692c2766091896112e5c4dac1b4f5c8fb02f /src/libpanic_unwind | |
| parent | 70456a6cbd67c0547d22997007afaaed0819767e (diff) | |
| download | rust-7d69d4ced23c446d6af341e3f9dc031a302150fc.tar.gz rust-7d69d4ced23c446d6af341e3f9dc031a302150fc.zip | |
Make use of `ptr::null(_mut)` instead of casting zero
Diffstat (limited to 'src/libpanic_unwind')
| -rw-r--r-- | src/libpanic_unwind/dummy.rs | 2 | ||||
| -rw-r--r-- | src/libpanic_unwind/seh.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/libpanic_unwind/dummy.rs b/src/libpanic_unwind/dummy.rs index 3a00d637665..86756326387 100644 --- a/src/libpanic_unwind/dummy.rs +++ b/src/libpanic_unwind/dummy.rs @@ -7,7 +7,7 @@ use core::any::Any; use core::intrinsics; pub fn payload() -> *mut u8 { - 0 as *mut u8 + core::ptr::null_mut() } pub unsafe fn cleanup(_ptr: *mut u8) -> Box<dyn Any + Send> { diff --git a/src/libpanic_unwind/seh.rs b/src/libpanic_unwind/seh.rs index 996fdb931ef..809e4619812 100644 --- a/src/libpanic_unwind/seh.rs +++ b/src/libpanic_unwind/seh.rs @@ -104,7 +104,7 @@ mod imp { pub const NAME2: [u8; 7] = [b'.', b'P', b'A', b'X', 0, 0, 0]; macro_rules! ptr { - (0) => (0 as *mut u8); + (0) => (core::ptr::null_mut()); ($e:expr) => ($e as *mut u8); } } @@ -223,13 +223,13 @@ extern "C" { #[cfg_attr(not(test), lang = "msvc_try_filter")] static mut TYPE_DESCRIPTOR1: _TypeDescriptor = _TypeDescriptor { pVFTable: unsafe { &TYPE_INFO_VTABLE } as *const _ as *const _, - spare: 0 as *mut _, + spare: core::ptr::null_mut(), name: imp::NAME1, }; static mut TYPE_DESCRIPTOR2: _TypeDescriptor = _TypeDescriptor { pVFTable: unsafe { &TYPE_INFO_VTABLE } as *const _ as *const _, - spare: 0 as *mut _, + spare: core::ptr::null_mut(), name: imp::NAME2, }; |
