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

Put noundef on all scalars that don't allow uninit #106294

Merged
merged 3 commits into from
Jan 17, 2023

Commits on Jan 17, 2023

  1. Put noundef on all scalars that don't allow uninit

    Previously, it was only put on scalars with range validity invariants
    like bool, was uninit was obviously invalid for those.
    
    Since then, we have normatively declared all uninit primitives to be
    undefined behavior and can therefore put `noundef` on them.
    
    The remaining concern was the `mem::uninitialized` function, which cause
    quite a lot of UB in the older parts of the ecosystem. This function now
    doesn't return uninit values anymore, making users of it safe from this
    change.
    
    The only real sources of UB where people could encounter uninit
    primitives are `MaybeUninit::uninit().assume_init()`, which has always
    be clear in the docs about being UB and from heap allocations (like
    reading from the spare capacity of a vec. This is hopefully rare enough
    to not break anything.
    Noratrieb committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    645c0fd View commit details
    Browse the repository at this point in the history
  2. Improve comments

    Noratrieb committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    af23ad9 View commit details
    Browse the repository at this point in the history
  3. Add more codegen tests

    Noratrieb committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    f125538 View commit details
    Browse the repository at this point in the history