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

(c2rust-analyze) Relax the transmutable checks from two-way to one-way, now allowing for arrays and slices to decay #841

Merged

Commits on Feb 19, 2023

  1. (c2rust-analyze) Relaxed the transmutable checks from two-way to on…

    …e-way, now allowing for arrays and slices to decay.
    
    This expands the definition of safe transmutability to be one-way.
    That is, it checks if `*T as *U` is safe, rather than also `*U as *T`.
    
    Thus, we can now allow for casts decaying
    pointers to arrays and slices to pointers to their element type.
    
    `do_unify` is modified to also be one-way,
    which it was already in all call sites.
    
    New tests are also added to `string_casts.rs`
    for all the types of ptr-to-ptr casts.
    
    Out of the full string cast, `b"" as *const u8 as *const core::ffi::c_char`,
    this adds support for the `as *const u8` (from `&[u8; _]`),
    so only support for the string literal itself remains.
    kkysen committed Feb 19, 2023
    Configuration menu
    Copy the full SHA
    0d88d7a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a148146 View commit details
    Browse the repository at this point in the history
  3. (c2rust-analyze) Fix the is_transmutable_to docs, formalizing the…

    … expanded defintion of safe transmutability.
    kkysen committed Feb 19, 2023
    Configuration menu
    Copy the full SHA
    26a4275 View commit details
    Browse the repository at this point in the history