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

Make casts of pointers to trait objects stricter #120248

Merged
merged 19 commits into from
Jul 8, 2024

Commits on Jul 4, 2024

  1. Configuration menu
    Copy the full SHA
    36b1f44 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d06cf5b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9e8ef92 View commit details
    Browse the repository at this point in the history
  4. Add more checks for pointers with vtable meta

    The rules for casting `*mut X<dyn A>` -> `*mut Y<dyn B>` are as follows:
    - If `B` has a principal
      - `A` must have exactly the same principal (including generics)
      - Auto traits of `B` must be a subset of autotraits in `A`
    
    Note that `X<_>` and `Y<_>` can be identity, or arbitrary structs with last field being the dyn type.
    The lifetime of the trait object itself (`dyn ... + 'a`) is not checked.
    
    This prevents a few soundness issues with `#![feature(arbitrary_self_types)]` and trait upcasting.
    Namely, these checks make sure that vtable is always valid for the pointee.
    WaffleLapkin committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    5645e8e View commit details
    Browse the repository at this point in the history
  5. blessings

    WaffleLapkin committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    bb651d3 View commit details
    Browse the repository at this point in the history
  6. Disallow dyn Trait -> dyn Auto back

    I think it's fine, but let's ask T-lang separately.
    WaffleLapkin committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    eac4916 View commit details
    Browse the repository at this point in the history
  7. test blessing

    WaffleLapkin committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    e85295c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c743557 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    340d69b View commit details
    Browse the repository at this point in the history
  10. Delete CloneAny from rust-analyzer's fork of AnyMap

    ...because it's very sketchy and causes FCWs.
    In this case it *is* actually sound, but still.
    
    I should write a better fork of anymap...
    WaffleLapkin committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    06863ee View commit details
    Browse the repository at this point in the history
  11. Small fixes from review

    WaffleLapkin committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    cf7032f View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    b16f803 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    dc420a2 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    52ba120 View commit details
    Browse the repository at this point in the history
  15. Fill in tracking issue

    WaffleLapkin committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    9ef533e View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    a1f20f1 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    56de9da View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2024

  1. Configuration menu
    Copy the full SHA
    073f3a2 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2024

  1. Configuration menu
    Copy the full SHA
    f3c13bf View commit details
    Browse the repository at this point in the history