Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generator: Apply must_use attributes to all Vulkan structs #845

Merged
merged 1 commit into from
Dec 5, 2023

Commits on Dec 5, 2023

  1. generator: Apply must_use attributes to all Vulkan structs

    All structs are marked as `Copy`, and builders move `self` for a
    convenient builder pattern directly on `default()` (using `&mut`
    requires requires first keeping the instance alive in a `let` binding).
    This however leads to builder functions accidentally moving a copy of
    `self`, mutating it, and dropping the result directly when the caller
    did not consume the returned value in ad-hoc field updates, in turn
    leaving the author confused why their code compiles without warnings
    while the struct was not updated.
    
    Annotating all Vulkan structs with `#[must_use]` should at least give
    them an idea why.
    MarijnS95 committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    a2fa06f View commit details
    Browse the repository at this point in the history