From bd69ab969cc36d6bd5fef37fa3155968e218d4ae Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sat, 25 May 2019 15:13:17 -0400 Subject: [PATCH 1/2] Replace mem::uninitialized with mem::zeroed Fixes #214 --- ash/src/device.rs | 54 +++++++++++------------ ash/src/entry.rs | 2 +- ash/src/extensions/ext/debug_report.rs | 2 +- ash/src/extensions/ext/debug_utils.rs | 2 +- ash/src/extensions/khr/android_surface.rs | 2 +- ash/src/extensions/khr/surface.rs | 4 +- ash/src/extensions/khr/swapchain.rs | 4 +- ash/src/extensions/khr/wayland_surface.rs | 2 +- ash/src/extensions/khr/win32_surface.rs | 2 +- ash/src/extensions/khr/xcb_surface.rs | 2 +- ash/src/extensions/khr/xlib_surface.rs | 2 +- ash/src/extensions/mvk/ios_surface.rs | 2 +- ash/src/extensions/mvk/macos_surface.rs | 2 +- ash/src/extensions/nv/ray_tracing.rs | 6 +-- ash/src/instance.rs | 16 +++---- ash/tests/constant_size_arrays.rs | 4 +- examples/src/bin/texture.rs | 2 +- examples/src/bin/triangle.rs | 2 +- examples/src/lib.rs | 2 +- 19 files changed, 57 insertions(+), 57 deletions(-) diff --git a/ash/src/device.rs b/ash/src/device.rs index 5684678..27cfa74 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -43,7 +43,7 @@ pub trait DeviceV1_1: DeviceV1_0 { local_device_index: u32, remote_device_index: u32, ) -> vk::PeerMemoryFeatureFlags { - let mut peer_memory_features = mem::uninitialized(); + let mut peer_memory_features = mem::zeroed(); self.fp_v1_1().get_device_group_peer_memory_features( self.handle(), heap_index, @@ -106,7 +106,7 @@ pub trait DeviceV1_1: DeviceV1_0 { &self, info: &vk::ImageSparseMemoryRequirementsInfo2, ) -> usize { - let mut count = mem::uninitialized(); + let mut count = mem::zeroed(); self.fp_v1_1().get_image_sparse_memory_requirements2( self.handle(), info, @@ -147,7 +147,7 @@ pub trait DeviceV1_1: DeviceV1_0 { create_info: &vk::SamplerYcbcrConversionCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut ycbcr_conversion = mem::uninitialized(); + let mut ycbcr_conversion = mem::zeroed(); let err_code = self.fp_v1_1().create_sampler_ycbcr_conversion( self.handle(), create_info, @@ -179,7 +179,7 @@ pub trait DeviceV1_1: DeviceV1_0 { create_info: &vk::DescriptorUpdateTemplateCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut descriptor_update_template = mem::uninitialized(); + let mut descriptor_update_template = mem::zeroed(); let err_code = self.fp_v1_1().create_descriptor_update_template( self.handle(), create_info, @@ -281,7 +281,7 @@ pub trait DeviceV1_0 { create_info: &vk::EventCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut event = mem::uninitialized(); + let mut event = mem::zeroed(); let err_code = self.fp_v1_0().create_event( self.handle(), create_info, @@ -592,7 +592,7 @@ pub trait DeviceV1_0 { create_info: &vk::SamplerCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut sampler = mem::uninitialized(); + let mut sampler = mem::zeroed(); let err_code = self.fp_v1_0().create_sampler( self.handle(), create_info, @@ -780,7 +780,7 @@ pub trait DeviceV1_0 { create_info: &vk::DescriptorSetLayoutCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut layout = mem::uninitialized(); + let mut layout = mem::zeroed(); let err_code = self.fp_v1_0().create_descriptor_set_layout( self.handle(), create_info, @@ -808,7 +808,7 @@ pub trait DeviceV1_0 { create_info: &vk::DescriptorPoolCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut pool = mem::uninitialized(); + let mut pool = mem::zeroed(); let err_code = self.fp_v1_0().create_descriptor_pool( self.handle(), create_info, @@ -1356,7 +1356,7 @@ pub trait DeviceV1_0 { create_info: &vk::SemaphoreCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut semaphore = mem::uninitialized(); + let mut semaphore = mem::zeroed(); let err_code = self.fp_v1_0().create_semaphore( self.handle(), create_info, @@ -1421,7 +1421,7 @@ pub trait DeviceV1_0 { create_info: &vk::BufferCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut buffer = mem::uninitialized(); + let mut buffer = mem::zeroed(); let err_code = self.fp_v1_0().create_buffer( self.handle(), create_info, @@ -1440,7 +1440,7 @@ pub trait DeviceV1_0 { create_info: &vk::PipelineLayoutCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut pipeline_layout = mem::uninitialized(); + let mut pipeline_layout = mem::zeroed(); let err_code = self.fp_v1_0().create_pipeline_layout( self.handle(), create_info, @@ -1459,7 +1459,7 @@ pub trait DeviceV1_0 { create_info: &vk::PipelineCacheCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut pipeline_cache = mem::uninitialized(); + let mut pipeline_cache = mem::zeroed(); let err_code = self.fp_v1_0().create_pipeline_cache( self.handle(), create_info, @@ -1510,7 +1510,7 @@ pub trait DeviceV1_0 { size: vk::DeviceSize, flags: vk::MemoryMapFlags, ) -> VkResult<*mut c_void> { - let mut data: *mut c_void = mem::uninitialized(); + let mut data: *mut c_void = mem::zeroed(); let err_code = self.fp_v1_0() .map_memory(self.handle(), memory, offset, size, flags, &mut data); @@ -1560,7 +1560,7 @@ pub trait DeviceV1_0 { create_info: &vk::FramebufferCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut framebuffer = mem::uninitialized(); + let mut framebuffer = mem::zeroed(); let err_code = self.fp_v1_0().create_framebuffer( self.handle(), create_info, @@ -1575,7 +1575,7 @@ pub trait DeviceV1_0 { #[doc = ""] unsafe fn get_device_queue(&self, queue_family_index: u32, queue_index: u32) -> vk::Queue { - let mut queue = mem::uninitialized(); + let mut queue = mem::zeroed(); self.fp_v1_0() .get_device_queue(self.handle(), queue_family_index, queue_index, &mut queue); queue @@ -1612,7 +1612,7 @@ pub trait DeviceV1_0 { create_info: &vk::RenderPassCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut renderpass = mem::uninitialized(); + let mut renderpass = mem::zeroed(); let err_code = self.fp_v1_0().create_render_pass( self.handle(), create_info, @@ -1709,7 +1709,7 @@ pub trait DeviceV1_0 { create_info: &vk::BufferViewCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut buffer_view = mem::uninitialized(); + let mut buffer_view = mem::zeroed(); let err_code = self.fp_v1_0().create_buffer_view( self.handle(), create_info, @@ -1741,7 +1741,7 @@ pub trait DeviceV1_0 { create_info: &vk::ImageViewCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut image_view = mem::uninitialized(); + let mut image_view = mem::zeroed(); let err_code = self.fp_v1_0().create_image_view( self.handle(), create_info, @@ -1778,7 +1778,7 @@ pub trait DeviceV1_0 { create_info: &vk::CommandPoolCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut pool = mem::uninitialized(); + let mut pool = mem::zeroed(); let err_code = self.fp_v1_0().create_command_pool( self.handle(), create_info, @@ -1797,7 +1797,7 @@ pub trait DeviceV1_0 { create_info: &vk::QueryPoolCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut pool = mem::uninitialized(); + let mut pool = mem::zeroed(); let err_code = self.fp_v1_0().create_query_pool( self.handle(), create_info, @@ -1816,7 +1816,7 @@ pub trait DeviceV1_0 { create_info: &vk::ImageCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut image = mem::uninitialized(); + let mut image = mem::zeroed(); let err_code = self.fp_v1_0().create_image( self.handle(), create_info, @@ -1835,7 +1835,7 @@ pub trait DeviceV1_0 { image: vk::Image, subresource: vk::ImageSubresource, ) -> vk::SubresourceLayout { - let mut layout = mem::uninitialized(); + let mut layout = mem::zeroed(); self.fp_v1_0().get_image_subresource_layout( self.handle(), image, @@ -1847,7 +1847,7 @@ pub trait DeviceV1_0 { #[doc = ""] unsafe fn get_image_memory_requirements(&self, image: vk::Image) -> vk::MemoryRequirements { - let mut mem_req = mem::uninitialized(); + let mut mem_req = mem::zeroed(); self.fp_v1_0() .get_image_memory_requirements(self.handle(), image, &mut mem_req); mem_req @@ -1855,7 +1855,7 @@ pub trait DeviceV1_0 { #[doc = ""] unsafe fn get_buffer_memory_requirements(&self, buffer: vk::Buffer) -> vk::MemoryRequirements { - let mut mem_req = mem::uninitialized(); + let mut mem_req = mem::zeroed(); self.fp_v1_0() .get_buffer_memory_requirements(self.handle(), buffer, &mut mem_req); mem_req @@ -1867,7 +1867,7 @@ pub trait DeviceV1_0 { create_info: &vk::MemoryAllocateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut memory = mem::uninitialized(); + let mut memory = mem::zeroed(); let err_code = self.fp_v1_0().allocate_memory( self.handle(), create_info, @@ -1886,7 +1886,7 @@ pub trait DeviceV1_0 { create_info: &vk::ShaderModuleCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut shader = mem::uninitialized(); + let mut shader = mem::zeroed(); let err_code = self.fp_v1_0().create_shader_module( self.handle(), create_info, @@ -1905,7 +1905,7 @@ pub trait DeviceV1_0 { create_info: &vk::FenceCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut fence = mem::uninitialized(); + let mut fence = mem::zeroed(); let err_code = self.fp_v1_0().create_fence( self.handle(), create_info, diff --git a/ash/src/entry.rs b/ash/src/entry.rs index ca6cef3..13caea4 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -143,7 +143,7 @@ impl EntryV1_0 for EntryCustom { create_info: &vk::InstanceCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> Result { - let mut instance: vk::Instance = mem::uninitialized(); + let mut instance: vk::Instance = mem::zeroed(); let err_code = self.fp_v1_0().create_instance( create_info, allocation_callbacks.as_raw_ptr(), diff --git a/ash/src/extensions/ext/debug_report.rs b/ash/src/extensions/ext/debug_report.rs index 1d50117..9d55070 100644 --- a/ash/src/extensions/ext/debug_report.rs +++ b/ash/src/extensions/ext/debug_report.rs @@ -46,7 +46,7 @@ impl DebugReport { create_info: &vk::DebugReportCallbackCreateInfoEXT, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut debug_cb = mem::uninitialized(); + let mut debug_cb = mem::zeroed(); let err_code = self.debug_report_fn.create_debug_report_callback_ext( self.handle, create_info, diff --git a/ash/src/extensions/ext/debug_utils.rs b/ash/src/extensions/ext/debug_utils.rs index a8acffd..a217d61 100644 --- a/ash/src/extensions/ext/debug_utils.rs +++ b/ash/src/extensions/ext/debug_utils.rs @@ -113,7 +113,7 @@ impl DebugUtils { create_info: &vk::DebugUtilsMessengerCreateInfoEXT, allocator: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut messenger = mem::uninitialized(); + let mut messenger = mem::zeroed(); let err_code = self.debug_utils_fn.create_debug_utils_messenger_ext( self.handle, create_info, diff --git a/ash/src/extensions/khr/android_surface.rs b/ash/src/extensions/khr/android_surface.rs index d9d343d..3c18b1e 100644 --- a/ash/src/extensions/khr/android_surface.rs +++ b/ash/src/extensions/khr/android_surface.rs @@ -33,7 +33,7 @@ impl AndroidSurface { create_info: &vk::AndroidSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut surface = mem::uninitialized(); + let mut surface = mem::zeroed(); let err_code = self.android_surface_fn.create_android_surface_khr( self.handle, create_info, diff --git a/ash/src/extensions/khr/surface.rs b/ash/src/extensions/khr/surface.rs index 03e4867..6e50756 100644 --- a/ash/src/extensions/khr/surface.rs +++ b/ash/src/extensions/khr/surface.rs @@ -35,7 +35,7 @@ impl Surface { queue_index: u32, surface: vk::SurfaceKHR, ) -> VkResult { - let mut b = mem::uninitialized(); + let mut b = mem::zeroed(); let err_code = self.surface_fn.get_physical_device_surface_support_khr( physical_device, queue_index, @@ -85,7 +85,7 @@ impl Surface { physical_device: vk::PhysicalDevice, surface: vk::SurfaceKHR, ) -> VkResult { - let mut surface_capabilities = mem::uninitialized(); + let mut surface_capabilities = mem::zeroed(); let err_code = self .surface_fn .get_physical_device_surface_capabilities_khr( diff --git a/ash/src/extensions/khr/swapchain.rs b/ash/src/extensions/khr/swapchain.rs index ade5d04..b7a34da 100644 --- a/ash/src/extensions/khr/swapchain.rs +++ b/ash/src/extensions/khr/swapchain.rs @@ -50,7 +50,7 @@ impl Swapchain { semaphore: vk::Semaphore, fence: vk::Fence, ) -> VkResult<(u32, bool)> { - let mut index = mem::uninitialized(); + let mut index = mem::zeroed(); let err_code = self.swapchain_fn.acquire_next_image_khr( self.handle, swapchain, @@ -72,7 +72,7 @@ impl Swapchain { create_info: &vk::SwapchainCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut swapchain = mem::uninitialized(); + let mut swapchain = mem::zeroed(); let err_code = self.swapchain_fn.create_swapchain_khr( self.handle, create_info, diff --git a/ash/src/extensions/khr/wayland_surface.rs b/ash/src/extensions/khr/wayland_surface.rs index ec5480d..d9909b9 100644 --- a/ash/src/extensions/khr/wayland_surface.rs +++ b/ash/src/extensions/khr/wayland_surface.rs @@ -33,7 +33,7 @@ impl WaylandSurface { create_info: &vk::WaylandSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut surface = mem::uninitialized(); + let mut surface = mem::zeroed(); let err_code = self.wayland_surface_fn.create_wayland_surface_khr( self.handle, create_info, diff --git a/ash/src/extensions/khr/win32_surface.rs b/ash/src/extensions/khr/win32_surface.rs index 72ae7ef..de40662 100644 --- a/ash/src/extensions/khr/win32_surface.rs +++ b/ash/src/extensions/khr/win32_surface.rs @@ -33,7 +33,7 @@ impl Win32Surface { create_info: &vk::Win32SurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut surface = mem::uninitialized(); + let mut surface = mem::zeroed(); let err_code = self.win32_surface_fn.create_win32_surface_khr( self.handle, create_info, diff --git a/ash/src/extensions/khr/xcb_surface.rs b/ash/src/extensions/khr/xcb_surface.rs index dbd05e8..454e576 100644 --- a/ash/src/extensions/khr/xcb_surface.rs +++ b/ash/src/extensions/khr/xcb_surface.rs @@ -33,7 +33,7 @@ impl XcbSurface { create_info: &vk::XcbSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut surface = mem::uninitialized(); + let mut surface = mem::zeroed(); let err_code = self.xcb_surface_fn.create_xcb_surface_khr( self.handle, create_info, diff --git a/ash/src/extensions/khr/xlib_surface.rs b/ash/src/extensions/khr/xlib_surface.rs index aed6ca4..269fa93 100644 --- a/ash/src/extensions/khr/xlib_surface.rs +++ b/ash/src/extensions/khr/xlib_surface.rs @@ -33,7 +33,7 @@ impl XlibSurface { create_info: &vk::XlibSurfaceCreateInfoKHR, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut surface = mem::uninitialized(); + let mut surface = mem::zeroed(); let err_code = self.xlib_surface_fn.create_xlib_surface_khr( self.handle, create_info, diff --git a/ash/src/extensions/mvk/ios_surface.rs b/ash/src/extensions/mvk/ios_surface.rs index 4aac1c5..d2c76c8 100644 --- a/ash/src/extensions/mvk/ios_surface.rs +++ b/ash/src/extensions/mvk/ios_surface.rs @@ -33,7 +33,7 @@ impl IOSSurface { create_info: &vk::IOSSurfaceCreateInfoMVK, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut surface = mem::uninitialized(); + let mut surface = mem::zeroed(); let err_code = self.ios_surface_fn.create_ios_surface_mvk( self.handle, create_info, diff --git a/ash/src/extensions/mvk/macos_surface.rs b/ash/src/extensions/mvk/macos_surface.rs index 9dbf44b..722eade 100644 --- a/ash/src/extensions/mvk/macos_surface.rs +++ b/ash/src/extensions/mvk/macos_surface.rs @@ -33,7 +33,7 @@ impl MacOSSurface { create_info: &vk::MacOSSurfaceCreateInfoMVK, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut surface = mem::uninitialized(); + let mut surface = mem::zeroed(); let err_code = self.macos_surface_fn.create_mac_os_surface_mvk( self.handle, create_info, diff --git a/ash/src/extensions/nv/ray_tracing.rs b/ash/src/extensions/nv/ray_tracing.rs index 02aa71f..4b0d11d 100644 --- a/ash/src/extensions/nv/ray_tracing.rs +++ b/ash/src/extensions/nv/ray_tracing.rs @@ -41,7 +41,7 @@ impl RayTracing { create_info: &vk::AccelerationStructureCreateInfoNV, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult { - let mut accel_struct = mem::uninitialized(); + let mut accel_struct = mem::zeroed(); let err_code = self.ray_tracing_fn.create_acceleration_structure_nv( self.handle, create_info, @@ -72,7 +72,7 @@ impl RayTracing { &self, info: &vk::AccelerationStructureMemoryRequirementsInfoNV, ) -> vk::MemoryRequirements2KHR { - let mut requirements = mem::uninitialized(); + let mut requirements = mem::zeroed(); self.ray_tracing_fn .get_acceleration_structure_memory_requirements_nv( self.handle, @@ -181,7 +181,7 @@ impl RayTracing { create_info: &[vk::RayTracingPipelineCreateInfoNV], allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> VkResult> { - let mut pipelines = vec![mem::uninitialized(); create_info.len()]; + let mut pipelines = vec![mem::zeroed(); create_info.len()]; let err_code = self.ray_tracing_fn.create_ray_tracing_pipelines_nv( self.handle, pipeline_cache, diff --git a/ash/src/instance.rs b/ash/src/instance.rs index 4db5ceb..aaff843 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -40,7 +40,7 @@ impl InstanceV1_0 for Instance { create_info: &vk::DeviceCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>, ) -> Result { - let mut device: vk::Device = mem::uninitialized(); + let mut device: vk::Device = mem::zeroed(); let err_code = self.fp_v1_0().create_device( physical_device, create_info, @@ -72,7 +72,7 @@ pub trait InstanceV1_1: InstanceV1_0 { fn fp_v1_1(&self) -> &vk::InstanceFnV1_1; unsafe fn enumerate_physical_device_groups_len(&self) -> usize { - let mut group_count = mem::uninitialized(); + let mut group_count = mem::zeroed(); self.fp_v1_1().enumerate_physical_device_groups( self.handle(), &mut group_count, @@ -291,7 +291,7 @@ pub trait InstanceV1_0 { physical_device: vk::PhysicalDevice, format: vk::Format, ) -> vk::FormatProperties { - let mut format_prop = mem::uninitialized(); + let mut format_prop = mem::zeroed(); self.fp_v1_0().get_physical_device_format_properties( physical_device, format, @@ -310,7 +310,7 @@ pub trait InstanceV1_0 { usage: vk::ImageUsageFlags, flags: vk::ImageCreateFlags, ) -> VkResult { - let mut image_format_prop = mem::uninitialized(); + let mut image_format_prop = mem::zeroed(); let err_code = self.fp_v1_0().get_physical_device_image_format_properties( physical_device, format, @@ -332,7 +332,7 @@ pub trait InstanceV1_0 { &self, physical_device: vk::PhysicalDevice, ) -> vk::PhysicalDeviceMemoryProperties { - let mut memory_prop = mem::uninitialized(); + let mut memory_prop = mem::zeroed(); self.fp_v1_0() .get_physical_device_memory_properties(physical_device, &mut memory_prop); memory_prop @@ -343,7 +343,7 @@ pub trait InstanceV1_0 { &self, physical_device: vk::PhysicalDevice, ) -> vk::PhysicalDeviceProperties { - let mut prop = mem::uninitialized(); + let mut prop = mem::zeroed(); self.fp_v1_0() .get_physical_device_properties(physical_device, &mut prop); prop @@ -375,7 +375,7 @@ pub trait InstanceV1_0 { &self, physical_device: vk::PhysicalDevice, ) -> vk::PhysicalDeviceFeatures { - let mut prop = mem::uninitialized(); + let mut prop = mem::zeroed(); self.fp_v1_0() .get_physical_device_features(physical_device, &mut prop); prop @@ -383,7 +383,7 @@ pub trait InstanceV1_0 { #[doc = ""] unsafe fn enumerate_physical_devices(&self) -> VkResult> { - let mut num = mem::uninitialized(); + let mut num = mem::zeroed(); self.fp_v1_0() .enumerate_physical_devices(self.handle(), &mut num, ptr::null_mut()); let mut physical_devices = Vec::::with_capacity(num as usize); diff --git a/ash/tests/constant_size_arrays.rs b/ash/tests/constant_size_arrays.rs index f736c0a..1af1a89 100644 --- a/ash/tests/constant_size_arrays.rs +++ b/ash/tests/constant_size_arrays.rs @@ -30,8 +30,8 @@ fn assert_ffi_array_param_is_pointer() { unsafe { // don't run it, just make sure it compiles if false { - let device: ash::Device = std::mem::uninitialized(); - let cmd_buffer = std::mem::uninitialized(); + let device: ash::Device = std::mem::zeroed(); + let cmd_buffer = std::mem::zeroed(); let blend_constants: [f32; 4] = [0.0, 0.0, 0.0, 0.0]; diff --git a/examples/src/bin/texture.rs b/examples/src/bin/texture.rs index 42664a5..0b4953d 100644 --- a/examples/src/bin/texture.rs +++ b/examples/src/bin/texture.rs @@ -791,7 +791,7 @@ fn main() { device.cmd_end_render_pass(draw_command_buffer); }, ); - //let mut present_info_err = mem::uninitialized(); + //let mut present_info_err = mem::zeroed(); let present_info = vk::PresentInfoKHR { wait_semaphore_count: 1, p_wait_semaphores: &base.rendering_complete_semaphore, diff --git a/examples/src/bin/triangle.rs b/examples/src/bin/triangle.rs index 0104344..0eb5530 100644 --- a/examples/src/bin/triangle.rs +++ b/examples/src/bin/triangle.rs @@ -441,7 +441,7 @@ fn main() { device.cmd_end_render_pass(draw_command_buffer); }, ); - //let mut present_info_err = mem::uninitialized(); + //let mut present_info_err = mem::zeroed(); let wait_semaphors = [base.rendering_complete_semaphore]; let swapchains = [base.swapchain]; let image_indices = [present_index]; diff --git a/examples/src/lib.rs b/examples/src/lib.rs index c329db8..fb43a4d 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -46,7 +46,7 @@ macro_rules! offset_of { ($base:path, $field:ident) => {{ #[allow(unused_unsafe)] unsafe { - let b: $base = mem::uninitialized(); + let b: $base = mem::zeroed(); (&b.$field as *const _ as isize) - (&b as *const _ as isize) } }}; From 0f9c737e66aee3b823f6607beaae2d107c01052c Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 26 May 2019 18:21:24 -0400 Subject: [PATCH 2/2] Use ptr::null_mut for void pointer initialization --- ash/src/device.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ash/src/device.rs b/ash/src/device.rs index 27cfa74..07214a7 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -1510,7 +1510,7 @@ pub trait DeviceV1_0 { size: vk::DeviceSize, flags: vk::MemoryMapFlags, ) -> VkResult<*mut c_void> { - let mut data: *mut c_void = mem::zeroed(); + let mut data: *mut c_void = ptr::null_mut(); let err_code = self.fp_v1_0() .map_memory(self.handle(), memory, offset, size, flags, &mut data);