From 39a6a8552a763e213ab2db6d8b9d6bdeec486b68 Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Sat, 29 Feb 2020 14:24:39 -0600 Subject: [PATCH] Add a Safety section to the documentation of create_instance and create_device (#272) * Add a Safety section to the documentation of `create_instance` and `create_device` * Change doc links back to original format --- ash/src/entry.rs | 8 ++++++++ ash/src/instance.rs | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/ash/src/entry.rs b/ash/src/entry.rs index eb3ab82..a181818 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -77,6 +77,10 @@ pub trait EntryV1_0 { type Instance; fn fp_v1_0(&self) -> &vk::EntryFnV1_0; fn static_fn(&self) -> &vk::StaticFn; + /// # Safety + /// In order for the created `Instance` to be valid for the duration of its + /// usage, the `Entry` this was called on must be dropped later than the + /// resulting `Instance`. #[doc = ""] unsafe fn create_instance( &self, @@ -138,6 +142,10 @@ pub trait EntryV1_0 { impl EntryV1_0 for EntryCustom { type Instance = Instance; + /// # Safety + /// In order for the created `Instance` to be valid for the duration of its + /// usage, the `Entry` this was called on must be dropped later than the + /// resulting `Instance`. #[doc = ""] unsafe fn create_instance( &self, diff --git a/ash/src/instance.rs b/ash/src/instance.rs index 4599a00..36d9d77 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -38,6 +38,10 @@ impl Instance { impl InstanceV1_0 for Instance { type Device = Device; + /// # Safety + /// In order for the created `Device` to be valid for the duration of its + /// usage, the `Instance` this was called on must be dropped later than the + /// resulting `Device`. #[doc = ""] unsafe fn create_device( &self, @@ -288,6 +292,10 @@ pub trait InstanceV1_0 { type Device; fn handle(&self) -> vk::Instance; fn fp_v1_0(&self) -> &vk::InstanceFnV1_0; + /// # Safety + /// In order for the created `Device` to be valid for the duration of its + /// usage, the `Instance` this was called on must be dropped later than the + /// resulting `Device`. #[doc = ""] unsafe fn create_device( &self,