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

Replace owning_ref with a safer datastructure #97770

Closed
wants to merge 3 commits into from

Commits on Jun 5, 2022

  1. Add owned_slice to rustc_data_structures

    The owned slice represents an owned value with a view into that
    owned slice. For example, it might own a `Vec<i32>` of `[1, 2]`,
    but only deref to `[2]`. It's almost entirely written using safe
    code, except for one unsafe block to calculate a pointer difference.
    Noratrieb committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    f62b007 View commit details
    Browse the repository at this point in the history
  2. Use owned_slice instead of owning_ref to store metadata.

    `owning_ref` of a `Box<T>` has soundness problems because it stores
    pointers to a box that is then invalidated. Instead, use the safer
    `owned_slice`, which presents a more specialized abstraction.
    This doesn't change the general layout or indirection of the structure,
    but only the datastructure used as a wrapper.
    Noratrieb committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    0974fd6 View commit details
    Browse the repository at this point in the history
  3. Delete owning_ref from rustc_data_structures

    `owning_ref` has soundness problems when used with `Box<T>`, and the
    previous commit replaced its usages with a better abstraction.
    This means that we can now get rid of it.
    Noratrieb committed Jun 5, 2022
    Configuration menu
    Copy the full SHA
    99419ea View commit details
    Browse the repository at this point in the history