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

Re-enable copy[_nonoverlapping]() debug-checks #90041

Merged
merged 1 commit into from
Nov 13, 2021

Commits on Nov 9, 2021

  1. Re-enable copy[_nonoverlapping]() runtime checks

    This commit re-enables the debug checks for valid usages of the two
    functions `copy()` and `copy_nonoverlapping()`. Those checks were com-
    mented out in rust-lang#79684 in order to make the functions const. All that's
    been left was a FIXME, that could not be resolved until there is was way
    to only do the checks at runtime.
    Since rust-lang#89247 there is such a way: `const_eval_select()`. This commit
    uses that new intrinsic in order to either do nothing (at compile time)
    or to do the old checks (at runtime).
    
    The change itself is rather small: in order to make the checks usable
    with `const_eval_select`, they are moved into a local function (one for
    `copy` and one for `copy_nonoverlapping` to keep symmetry).
    
    The change does not break referential transparency, as there is nothing
    you can do at compile time, which you cannot do on runtime without get-
    ting undefined behavior. The CTFE-engine won't allow missuses. The other
    way round is also fine.
    jfrimmel committed Nov 9, 2021
    Configuration menu
    Copy the full SHA
    60a9d5a View commit details
    Browse the repository at this point in the history