From c1b540ac9643400669109740d189d0763e8e81b6 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Fri, 22 Mar 2019 11:00:56 +0100 Subject: [PATCH] Improve temporary lifetimes rules in readme Co-Authored-By: MaikKlein --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a940336..9413374 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ impl<'a> DeviceCreateInfoBuilder<'a> { Every reference has to live as long as the builder itself. Builders implement `Deref` targeting their corresponding Vulkan struct, so references to builders can be passed directly to Vulkan functions. -Calling `.build()` will **discard** that lifetime because Vulkan structs use raw pointers internally. This should be avoided as much as possible because this can easily lead to dangling pointers. If `.build()` has to be called, it should be called as late as possible. The reason for this is that the lifetime of [temporaries](https://doc.rust-lang.org/reference/expressions.html#temporary-lifetimes) will be extended to the enclosing block. +Calling `.build()` will **discard** that lifetime because Vulkan structs use raw pointers internally. This should be avoided as much as possible because this can easily lead to dangling pointers. If `.build()` has to be called, it should be called as late as possible. [Lifetimes of temporaries](https://doc.rust-lang.org/reference/expressions.html#temporary-lifetimes) are extended to the enclosing statement, ensuring they are valid for the duration of a Vulkan call occurring in the same statement. ### Pointer chains