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

Rollup of 5 pull requests #127486

Merged
merged 30 commits into from
Jul 8, 2024
Merged

Rollup of 5 pull requests #127486

merged 30 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
  2. Add test.

    cjgillot committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    6aebb2c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b97f83b View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2024

  1. Update compiler/rustc_mir_transform/src/gvn.rs

    Co-authored-by: Michael Goulet <[email protected]>
    cjgillot and compiler-errors authored Jul 6, 2024
    Configuration menu
    Copy the full SHA
    12edc8d View commit details
    Browse the repository at this point in the history
  2. Mark format! with must_use hint

    lukas committed Jul 6, 2024
    Configuration menu
    Copy the full SHA
    3e9c9a0 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2024

  1. Configuration menu
    Copy the full SHA
    a0f2b41 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f3c13bf View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8076a33 View commit details
    Browse the repository at this point in the history

Commits on Jul 8, 2024

  1. Rollup merge of rust-lang#120248 - WaffleLapkin:bonk-ptr-object-casts…

    …, r=compiler-errors,oli-obk,lnicola
    
    Make casts of pointers to trait objects stricter
    
    This is an attempt to `fix` rust-lang#120222 and rust-lang#120217.
    
    This is done by adding restrictions on casting pointers to trait objects.
    
    Before this PR the rules were as follows:
    
    > When casting `*const X<dyn A>` -> `*const Y<dyn B>`, principal traits in `A` and `B` must refer to the same trait definition (or no trait).
    
    With this PR the rules are changed to
    
    > When casting `*const X<dyn Src>` -> `*const Y<dyn Dst>`
    > - if `Dst` has a principal trait `DstP`,
    >   - `Src` must have a principal trait `SrcP`
    >   - `dyn SrcP` and `dyn DstP` must be the same type (modulo the trait object lifetime, `dyn T+'a` -> `dyn T+'b` is allowed)
    >   - Auto traits in `Dst` must be a subset of auto traits in `Src`
    >     - Not adhering to this is currently a FCW (warn-by-default + `FutureReleaseErrorReportInDeps`), instead of an error
    > - if `Src` has a principal trait `Dst` must as well
    >   - this restriction will be removed in a follow up PR
    
    This ensures that
    1. Principal trait's generic arguments match (no `*const dyn Tr<A>` -> `*const dyn Tr<B>` casts, which are a problem for [rust-lang#120222](rust-lang#120222))
    2. Principal trait's lifetime arguments match (no `*const dyn Tr<'a>` -> `*const dyn Tr<'b>` casts, which are a problem for [rust-lang#120217](rust-lang#120217))
    3. No auto traits can be _added_ (this is a problem for arbitrary self types, see [this comment](rust-lang#120248 (comment)))
    
    Some notes:
     - We only care about the metadata/last field, so you can still cast `*const dyn T` to `*const WithHeader<dyn T>`, etc
    - The lifetime of the trait object itself (`dyn A + 'lt`) is not checked, so you can still cast `*mut FnOnce() + '_` to `*mut FnOnce() + 'static`, etc
      - This feels fishy, but I couldn't come up with a reason it must be checked
    
    The diagnostics are currently not great, to say the least, but as far as I can tell this correctly fixes the issues.
    
    cc `@oli-obk` `@compiler-errors` `@lcnr`
    matthiaskrgr authored Jul 8, 2024
    Configuration menu
    Copy the full SHA
    c4ee2df View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#127355 - aceArt-GmbH:126475, r=oli-obk

    Mark format! with must_use hint
    
    Uses unstable feature rust-lang#94745
    
    Part of rust-lang#126475
    
    First contribution to rust, please let me know if the blessing of tests is correct
    Thanks `@bjorn3` for the help
    matthiaskrgr authored Jul 8, 2024
    Configuration menu
    Copy the full SHA
    5b6eb28 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#127399 - cjgillot:issue-127396, r=oli-obk

    Verify that allocations output by GVN are sufficiently aligned.
    
    Fixes rust-lang#127396
    
    r? `@oli-obk`
    matthiaskrgr authored Jul 8, 2024
    Configuration menu
    Copy the full SHA
    3e8e8df View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#127460 - Borgerr:clarify-drop-comment, r=jh…

    …pratt
    
    clarify `sys::unix::fd::FileDesc::drop` comment
    
    closes rust-lang#66876
    
    simply clarifies some resource-relevant things regarding the `close` syscall to reduce the amount of search needed in other parts of the web.
    matthiaskrgr authored Jul 8, 2024
    Configuration menu
    Copy the full SHA
    55d25ce View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#127467 - GrigorenkoPV:bootstrap-once_cell, …

    …r=clubby789
    
    bootstrap: once_cell::sync::Lazy -> std::sync::LazyLock
    
    Since rust-lang#121377 has landed on beta
    matthiaskrgr authored Jul 8, 2024
    Configuration menu
    Copy the full SHA
    a659f7a View commit details
    Browse the repository at this point in the history