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

never construct value on stack in new_box_zeroed (#1601) #1604

Open
wants to merge 1 commit into
base: v0.7.x
Choose a base branch
from

Commits on Sep 3, 2024

  1. never construct value on stack in new_box_zeroed (#1601)

    On lower opt-levels the compiler might not optimize out the
    `layout.size() == 0` branch and emits code for the if-body. This will
    cause a stack allocation for `Self`. Avoid calling new_zeroed() and
    directly construct the Box from a dangling pointer instead.
    
    Co-authored-by: Joshua Liebow-Feeser <[email protected]>
    Freax13 and joshlf committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    a9b600e View commit details
    Browse the repository at this point in the history