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 8 pull requests #122900

Merged
merged 21 commits into from
Mar 23, 2024
Merged

Rollup of 8 pull requests #122900

merged 21 commits into from
Mar 23, 2024

Commits on Mar 16, 2024

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

Commits on Mar 17, 2024

  1. Configuration menu
    Copy the full SHA
    55067c5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3bbbe3c View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2024

  1. compiler: allow transmute of ZST arrays with generics

    Extend the `SizeSkeleton` evaluator to shortcut zero-sized arrays, thus
    considering `[T; 0]` to have a compile-time fixed-size of 0.
    
    The existing evaluator already deals with generic arrays under the
    feature-guard `transmute_const_generics`. However, it merely allows
    comparing fixed-size types with fixed-size types, and generic types with
    generic types. For generic types, it merely compares whether their
    arguments match (ordering them first). Even if their exact sizes are not
    known at compile time, it can ensure that they will eventually be the
    same.
    
    This patch extends this by shortcutting the size-evaluation of zero
    sized arrays and thus allowing size comparisons of `()` with `[T; 0]`,
    where one contains generics and the other does not.
    
    This code is guarded by `transmute_const_generics` (rust-lang#109929), even
    though it is unclear whether it should be. However, this assumes that a
    separate stabilization PR is required to move this out of the feature
    guard.
    
    Initially reported in rust-lang#98104.
    dvdhrm committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    31d23c4 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2024

  1. Configuration menu
    Copy the full SHA
    1590026 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4b87c0b View commit details
    Browse the repository at this point in the history
  3. Use != Positive rather than == Negative

    Feels more complete, and for ImplPolarity has the side-effect of making
    sure we also handle reservation impls correctly
    compiler-errors committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    127e42d View commit details
    Browse the repository at this point in the history
  4. Fix clippy

    compiler-errors committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    560c6cc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d677a2d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ada6c16 View commit details
    Browse the repository at this point in the history
  7. add test for rust-lang#97725

    matthiaskrgr committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    5b5dec3 View commit details
    Browse the repository at this point in the history
  8. add test for rust-lang#105210 assertion failure self.lines.iter().all…

    …(|r| !r.iter().any(|sc| sc.chr == \'\\t\')) with edition 2021
    
    Fixes rust-lang#105210
    matthiaskrgr committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    2171243 View commit details
    Browse the repository at this point in the history
  9. Add tag_for_variant query

    This query allows for sharing code between `rustc_const_eval` and
    `rustc_transmutability`.
    
    Also moves `DummyMachine` to `rustc_const_eval`.
    jswrenn committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    2de9010 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#114009 - dvdhrm:pr/transmzst, r=pnkfelix

    compiler: allow transmute of ZST arrays with generics
    
    Extend the `SizeSkeleton` evaluator to shortcut zero-sized arrays, thus considering `[T; 0]` to have a compile-time fixed-size of 0.
    
    The existing evaluator already deals with generic arrays under the feature-guard `transmute_const_generics`. However, it merely allows comparing fixed-size types with fixed-size types, and generic types with generic types. For generic types, it merely compares whether their arguments match (ordering them first). Even if their exact sizes are not known at compile time, it can ensure that they will eventually be the same.
    
    This patch extends this by shortcutting the size-evaluation of zero sized arrays and thus allowing size comparisons of `()` with `[T; 0]`, where one contains generics and the other does not.
    
    This code is guarded by `transmute_const_generics` (rust-lang#109929), even though it is unclear whether it should be. However, this assumes that a separate stabilization PR is required to move this out of the feature guard.
    
    Initially reported in rust-lang#98104.
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    104c4bc View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#122195 - jieyouxu:impl-return-note, r=fmease

    Note that the caller chooses a type for type param
    
    ```
    error[E0308]: mismatched types
      --> $DIR/return-impl-trait.rs:23:5
       |
    LL | fn other_bounds<T>() -> T
       |                 -       -
       |                 |       |
       |                 |       expected `T` because of return type
       |                 |       help: consider using an impl return type: `impl Trait`
       |                 expected this type parameter
    ...
    LL |     ()
       |     ^^ expected type parameter `T`, found `()`
       |
       = note: expected type parameter `T`
                       found unit type `()`
       = note: the caller chooses the type of T which can be different from ()
    ```
    
    Tried to see if "expected this type parameter" can be replaced, but that goes all the way to `rustc_infer` so seems not worth the effort and can affect other diagnostics.
    
    Revives rust-lang#112088 and rust-lang#104755.
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    aa184c5 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#122651 - kornelski:flat-turbofish, r=spasto…

    …rino,compiler-errors
    
    Suggest `_` for missing generic arguments in turbofish
    
    The compiler may suggest unusable generic type names for missing generic arguments in an expression context:
    
    ```rust
    fn main() {
        (0..1).collect::<Vec>()
    }
    ```
    
    > help: add missing generic argument
    >
    >      (0..1).collect::<Vec<T>>()
    
    but `T` is not a valid name in this context, and this suggestion won't compile.
    
    I've changed it to use `_` inside method calls (turbofish), so it will suggest `(0..1).collect::<Vec<_>>()` which _may_ compile.
    
    It's possible that the suggested `_` will be ambiguous, but there is very extensive E0283 that will help resolve that, which is more helpful than a basic "cannot find type `T` in this scope" users would get otherwise.
    
    Out of caution to limit scope of the change I've limited it to just turbofish, but I suspect `_` could be the better choice in more cases. Perhaps in all expressions?
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    4e59457 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#122784 - jswrenn:tag_for_variant, r=compile…

    …r-errors
    
    Add `tag_for_variant` query
    
    This query allows for sharing code between `rustc_const_eval` and `rustc_transmutability`. It's a precursor to a PR I'm working on to entirely replace the bespoke layout computations in `rustc_transmutability`.
    
    r? `@compiler-errors`
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    96be3e7 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#122839 - compiler-errors:predicate-polarity…

    …, r=lcnr
    
    Split out `PredicatePolarity` from `ImplPolarity`
    
    Because having to deal with a third `Reservation` level in all the trait solver code is kind of weird.
    
    r? `@lcnr` or `@oli-obk`
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    8030692 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#122873 - badboy:mailmap-mail-merge, r=Mark-…

    …Simulacrum
    
    Merge my contributor emails into one using mailmap
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    5624af3 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#122885 - spastorino:spastorino-adhoc_groups…

    …, r=compiler-errors
    
    Adjust better spastorino membership to triagebot's adhoc_groups
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    1fe9713 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#122888 - matthiaskrgr:evenmoretests, r=comp…

    …iler-errors
    
    add a couple more tests
    matthiaskrgr authored Mar 22, 2024
    Configuration menu
    Copy the full SHA
    4879338 View commit details
    Browse the repository at this point in the history