ash-rs / ash

Vulkan bindings for Rust
Apache License 2.0
1.76k stars 186 forks source link

Lifetimes for Structures exceed their Builder's lifetime #902

Closed BitSyndicate1 closed 3 months ago

BitSyndicate1 commented 3 months ago

When passing in a reference to an array in a builder for example for the RenderPassCreateInfoBuilder like this:

        let create_info = ash::vk::RenderPassCreateInfo::builder()
            .attachments(&[color_attachment])
            .subpasses(&[sub_pass])
            .dependencies(&[dependency])
            .build();

After the create_info is build, The slices can be preemptively freed.

Fix suggestion: Introduce a PhantomData with the lifetime of the Builder in such cases.

Friz64 commented 3 months ago

Please see #866. A fix for this will be released in the new release, which is due very soon.

MarijnS95 commented 3 months ago

Duplicate of #223, #441, #602, #866 (and likely a bunch more).