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 9 pull requests #131275

Merged
merged 22 commits into from
Oct 5, 2024
Merged

Rollup of 9 pull requests #131275

merged 22 commits into from
Oct 5, 2024

Commits on Sep 23, 2024

  1. Configuration menu
    Copy the full SHA
    97fbcf6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3dfb30c View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2024

  1. update Literal's intro

    slanterns authored Oct 1, 2024
    Configuration menu
    Copy the full SHA
    30ff400 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9b52fb5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0dc250c View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2024

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

Commits on Oct 4, 2024

  1. Configuration menu
    Copy the full SHA
    3686e59 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e08002f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ae5f58d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fd7ee48 View commit details
    Browse the repository at this point in the history
  5. Account for impl Trait { when impl Trait for Type { was intended

    On editions where bare traits are never allowed, detect if the user has
    written `impl Trait` with no type, silence any dyn-compatibility errors,
    and provide a structured suggestion for the potentially missing type:
    
    ```
    error[E0782]: trait objects must include the `dyn` keyword
      --> $DIR/missing-for-type-in-impl.rs:8:6
       |
    LL | impl Foo<i64> {
       |      ^^^^^^^^
       |
    help: add `dyn` keyword before this trait
       |
    LL | impl dyn Foo<i64> {
       |      +++
    help: you might have intended to implement this trait for a given type
       |
    LL | impl Foo<i64> for /* Type */ {
       |               ++++++++++++++
    ```
    estebank committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    e057c43 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2024

  1. Configuration menu
    Copy the full SHA
    6b67c46 View commit details
    Browse the repository at this point in the history
  2. Bless clippy.

    cjgillot committed Oct 5, 2024
    Configuration menu
    Copy the full SHA
    479779d View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#129517 - cjgillot:known-panic-array, r=pnkf…

    …elix
    
    Compute array length from type for unconditional panic lint.
    
    Fixes rust-lang#98444
    
    The cases that involve slicing are harder, so rust-lang#38035 remains open.
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    f09e5a7 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#130367 - compiler-errors:super-unconstraine…

    …d, r=spastorino
    
    Check elaborated projections from dyn don't mention unconstrained late bound lifetimes
    
    Check that the projections that are *not* explicitly written but which we deduce from elaborating the principal of a `dyn` *also* do not reference unconstrained late-bound lifetimes, just like the ones that the user writes by hand.
    
    That is to say, given:
    
    ```
    trait Foo<T>: Bar<Assoc = T> {}
    
    trait Bar {
        type Assoc;
    }
    ```
    
    The type `dyn for<'a> Foo<&'a T>` (basically) elaborates to `dyn for<'a> Foo<&'a T> + for<'a> Bar<Assoc = &'a T>`[^1]. However, the `Bar` projection predicate is not well-formed, since `'a` must show up in the trait's arguments to be referenced in the term of a projection. We must error in this situation[^well], or else `dyn for<'a> Foo<&'a T>` is unsound.
    
    We already detect this for user-written projections during HIR->rustc_middle conversion, so this largely replicates that logic using the helper functions that were already conveniently defined.
    
    ---
    
    I'm cratering this first to see the fallout; if it's minimal or zero, then let's land it as-is. If not, the way that this is implemented is very conducive to an FCW.
    
    ---
    
    Fixes rust-lang#130347
    
    [^1]: We don't actually elaborate it like that in rustc; we only keep the principal trait ref `Foo<&'a T>` and the projection part of `Bar<Assoc = ...>`, but it's useful to be a bit verbose here for the purpose of explaining the issue.
    [^well]: Well, we could also make `dyn for<'a> Foo<&'a T>` *not* implement `for<'a> Bar<Assoc = &'a T>`, but this is inconsistent with the case where the user writes `Assoc = ...` in the type itself, and it overly complicates the implementation of trait objects' built-in impls.
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    9510c73 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#130403 - eduardosm:stabilize-const_slice_fr…

    …om_raw_parts_mut, r=workingjubilee
    
    Stabilize `const_slice_from_raw_parts_mut`
    
    Stabilizes rust-lang#67456, since rust-lang#57349 has been stabilized.
    
    Stabilized const API:
    ```rust
    // core::ptr
    pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T];
    
    // core::slice
    pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T];
    
    // core::ptr::NonNull
    pub const fn slice_from_raw_parts(data: NonNull<T>, len: usize) -> Self
    ```
    
    Closes rust-lang#67456.
    
    r? libs-api
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    49c6d78 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#130633 - eholk:pin-reborrow-self, r=compile…

    …r-errors
    
    Add support for reborrowing pinned method receivers
    
    This builds on rust-lang#130526 to add pinned reborrowing for method receivers. This enables the folllowing examples to work:
    
    ```rust
    #![feature(pin_ergonomics)]
    #![allow(incomplete_features)]
    
    use std::pin::Pin;
    
    pub struct Foo;
    
    impl Foo {
        fn foo(self: Pin<&mut Self>) {
        }
    
        fn baz(self: Pin<&Self>) {
        }
    }
    
    pub fn bar(x: Pin<&mut Foo>) {
        x.foo();
        x.foo();
    
        x.baz(); // Pin<&mut Foo> is downgraded to Pin<&Foo>
    }
    
    pub fn baaz(x: Pin<&Foo>) {
        x.baz();
        x.baz();
    }
    ```
    
    This PR includes the original one, which is currently in the commit queue, but the only code changes are in the latest commit (d3c53aa).
    
    rust-lang#130494
    
    r? `@compiler-errors`
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    68de7d1 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#131105 - slanterns:literal_c_str, r=petroch…

    …enkov
    
    update `Literal`'s intro
    
    Just something missd when adding c_str to it.
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    5bad4e9 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#131194 - practicalrs:fix_needless_lifetimes…

    …, r=celinval
    
    Fix needless_lifetimes in stable_mir
    
    Hi,
    
    This PR fixes the following clippy warning in stable_mir
    
    ```
    warning: the following explicit lifetimes could be elided: 'a
      --> compiler/stable_mir/src/mir/visit.rs:79:30
       |
    79 |     fn visit_projection_elem<'a>(
       |                              ^^
    80 |         &mut self,
    81 |         place_ref: PlaceRef<'a>,
       |                             ^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
       = note: `#[warn(clippy::needless_lifetimes)]` on by default
    help: elide the lifetimes
       |
    79 ~     fn visit_projection_elem(
    80 |         &mut self,
    81 ~         place_ref: PlaceRef<'_>,
       |
    ```
    
    Best regards,
    Michal
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    bc2f732 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#131260 - notriddle:notriddle/disambiguator-…

    …error, r=GuillaumeGomez
    
    rustdoc: cleaner errors on disambiguator/namespace mismatches
    
    Resolves rust-lang#131224 (review)
    
    r? `@jyn514`
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    f66aa60 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#131267 - okaneco:bufread_skip_until, r=tgro…

    …ss35
    
    Stabilize `BufRead::skip_until`
    
    FCP completed rust-lang#111735 (comment)
    
    Closes rust-lang#111735
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    3078b23 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#131273 - estebank:issue-131051, r=compiler-…

    …errors
    
    Account for `impl Trait {` when `impl Trait for Type {` was intended
    
    On editions where bare traits are never allowed, detect if the user has written `impl Trait` with no type, silence any dyn-compatibility errors, and provide a structured suggestion for the potentially missing type:
    
    ```
    error[E0782]: trait objects must include the `dyn` keyword
      --> $DIR/missing-for-type-in-impl.rs:8:6
       |
    LL | impl Foo<i64> {
       |      ^^^^^^^^
       |
    help: add `dyn` keyword before this trait
       |
    LL | impl dyn Foo<i64> {
       |      +++
    help: you might have intended to implement this trait for a given type
       |
    LL | impl Foo<i64> for /* Type */ {
       |               ++++++++++++++
    ```
    
    CC rust-lang#131051.
    workingjubilee authored Oct 5, 2024
    Configuration menu
    Copy the full SHA
    08689af View commit details
    Browse the repository at this point in the history