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 #107400

Merged
merged 21 commits into from
Jan 28, 2023
Merged

Rollup of 8 pull requests #107400

merged 21 commits into from
Jan 28, 2023

Commits on Jan 19, 2023

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

Commits on Jan 23, 2023

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

Commits on Jan 25, 2023

  1. Configuration menu
    Copy the full SHA
    800f1f3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b83ab0c View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2023

  1. Configuration menu
    Copy the full SHA
    381187d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    43cb610 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e5995e6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5bfd90e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    80a1536 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ff2413d View commit details
    Browse the repository at this point in the history
  7. Add some comments

    compiler-errors committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    0654374 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8a0b215 View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2023

  1. Configuration menu
    Copy the full SHA
    3e9d1e4 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#107022 - scottmcm:ordering-option-eq, r=m-o…

    …u-se
    
    Implement `SpecOptionPartialEq` for `cmp::Ordering`
    
    Noticed as I continue to explore options for having code using `partial_cmp` optimize better.
    
    Before:
    ```llvm
    ; Function Attrs: mustprogress nofree nosync nounwind willreturn uwtable
    define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #0 {
    start:
      %2 = icmp eq i8 %0, 2
      br i1 %2, label %bb1.i, label %bb3.i
    
    bb1.i:                                            ; preds = %start
      %3 = icmp eq i8 %1, 2
      br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"
    
    bb3.i:                                            ; preds = %start
      %.not.i = icmp ne i8 %1, 2
      %4 = icmp eq i8 %0, %1
      %spec.select.i = and i1 %.not.i, %4
      br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"
    
    "_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit": ; preds = %bb1.i, %bb3.i
      %.0.i = phi i1 [ %3, %bb1.i ], [ %spec.select.i, %bb3.i ]
      ret i1 %.0.i
    }
    ```
    
    After:
    ```llvm
    ; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable
    define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #1 {
    start:
      %2 = icmp eq i8 %0, %1
      ret i1 %2
    }
    ```
    
    (Which <https://alive2.llvm.org/ce/z/-rop5r> says LLVM *could* just do itself, but there's probably an issue already open for that problem from when this was originally looked at for `Option<NonZeroU8>` and friends.)
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    7b78b6a View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#107100 - compiler-errors:issue-107087, r=lcnr

    Use proper `InferCtxt` when probing for associated types in astconv
    
    Fixes rust-lang#107087
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    28188d1 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#107103 - compiler-errors:new-solver-evaluat…

    …e_obligation, r=lcnr
    
    Use new solver in `evaluate_obligation` query (when new solver is enabled)
    
    (only when `-Ztrait-solver=next`, of course)
    
    ... Does this make sense? It seems to me like it should be reasonable, but maybe there's some reason why this is a bad idea.
    
    r? ``@lcnr``
    
    Needs a perf run because I guess this `solver == TraitSolver::Next` check is on a hot path.
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    3b6593a View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#107190 - fmease:fix-81698, r=compiler-errors

    Recover from more const arguments that are not wrapped in curly braces
    
    Recover from some array, borrow, tuple & arithmetic expressions in const argument positions that lack curly braces and provide a suggestion to fix the issue continuing where rust-lang#92884 left off. Examples of such expressions: `[]`, `[0]`, `[1, 2]`, `[0; 0xff]`, `&9`, `("", 0)` and `(1 + 2) * 3` (we previously did not recover from them).
    
    I am not entirely happy with my current solution because the code that recovers from `[0]` (coinciding with a malformed slice type) and `[0; 0]` (coinciding with a malformed array type) is quite fragile as the aforementioned snippets are actually successfully parsed as types by `parse_ty` since it itself already recovers from them (returning `[⟨error⟩]` and `[⟨error⟩; 0]` respectively) meaning I have to manually look for `TyKind::Err`s and construct a separate diagnostic for the suggestion to attach to (thereby emitting two diagnostics in total).
    
    Fixes rust-lang#81698.
    `@rustbot` label A-diagnostics
    r? diagnostics
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    260e048 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#107306 - compiler-errors:correct-sugg-for-c…

    …losure-arg-needs-borrow, r=oli-obk
    
    Correct suggestions for closure arguments that need a borrow
    
    Fixes rust-lang#107301 by dealing with binders correctly
    Fixes another issue where we were suggesting adding just `&` when we expected `&mut _` in a closure arg
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    fa2cd94 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#107339 - aliemjay:covariant, r=lcnr

    internally change regions to be covariant
    
    Surprisingly, we consider the reference type `&'a T` to be contravaraint in its lifetime parameter. This is confusing and conflicts with the documentation we have in the reference, rustnomicon, and rustc-dev-guide. This also arguably not the correct use of terminology since we can use `&'static u8` in a place where `&' a u8` is expected, this implies that `&'static u8 <: &' a u8` and consequently `'static <: ' a`, hence covariance.
    
    Because of this, when relating two types, we used to switch the argument positions in a confusing way:
    `Subtype(&'a u8 <: &'b u8) => Subtype('b <: 'a) => Outlives('a: 'b) => RegionSubRegion('b <= 'a)`
    
    The reason for the current behavior is probably that we wanted `Subtype('b <: 'a)` and `RegionSubRegion('b <= 'a)` to be equivalent, but I don' t think this is a good reason since these relations are sufficiently different in that the first is a relation in the subtyping lattice and is intrinsic to the type-systems, while the the second relation is an implementation detail of regionck.
    
    This PR changes this behavior to use covariance, so..
    `Subtype(&'a u8 <: &'b u8) => Subtype('a <: 'b) => Outlives('a: 'b) => RegionSubRegion('b <= 'a) `
    
    Resolves rust-lang#103676
    
    r? `@lcnr`
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    a5caa98 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#107344 - compiler-errors:new-solver-tweaks,…

    … r=lcnr
    
    Minor tweaks in the new solver
    
    1. `InferCtxt::probe` is not needed in `compute_subtype_goal` and `compute_well_formed_goal`.
    2. Add a handful of comments.
    3. Add a micro-optimization in `consider_assumption` where we check the def-ids of the assumption and goal match before instantiating any binders.
    
    r? ``@lcnr``
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    ab769a0 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#107373 - michaelwoerister:dont-merge-vtable…

    …s-when-debuginfo, r=WaffleLapkin
    
    Don't merge vtables when full debuginfo is enabled.
    
    This PR makes the compiler not emit the `unnamed_addr` attribute for vtables when full debuginfo is enabled, so that they don't get merged even if they have the same contents. This allows debuggers to more reliably map from a dyn pointer to the self-type of a trait object by looking at the vtable's debuginfo.
    
    The PR only changes the behavior of the LLVM backend as other backends don't emit vtable debuginfo (as far as I can tell).
    
    The performance impact of this change should be small as [measured](rust-lang#103514 (comment)) in a previous PR.
    matthiaskrgr authored Jan 28, 2023
    Configuration menu
    Copy the full SHA
    c89bb15 View commit details
    Browse the repository at this point in the history