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

Closed
wants to merge 17 commits into from

Commits on Apr 22, 2020

  1. Handle binop on unbound type param

    When encountering a binary operation involving a type parameter that has
    no bindings, suggest adding the appropriate bound.
    estebank committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    2e89ade View commit details
    Browse the repository at this point in the history
  2. Suggest restricting type param when it doesn't satisfy projection

    When encountering a projection that isn't satisfied by a type parameter,
    suggest constraining the type parameter.
    estebank committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    b3eaccb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ddf322f View commit details
    Browse the repository at this point in the history
  4. On incorrect equality constraint likely to be assoc type, suggest app…

    …ropriate syntax
    
    When encountering `where <A as Foo>::Bar = B`, it is possible that `Bar`
    is an associated type. If so, suggest `where A: Foo<Bar = B>`.
    
    CC rust-lang#20041.
    estebank committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    c2b5373 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8e67570 View commit details
    Browse the repository at this point in the history
  6. review comment: use body_id

    estebank committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    c0a9d52 View commit details
    Browse the repository at this point in the history

Commits on May 2, 2020

  1. typo

    lcnr authored May 2, 2020
    Configuration menu
    Copy the full SHA
    a691521 View commit details
    Browse the repository at this point in the history
  2. slice::fill: take T by value.

    lcnr committed May 2, 2020
    Configuration menu
    Copy the full SHA
    902aa62 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c05961c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f3ec00a View commit details
    Browse the repository at this point in the history
  5. Test associated const default qualifs cross-crate

    This also tests for the ICE in rust-lang#71734
    ecstatic-morse committed May 2, 2020
    Configuration menu
    Copy the full SHA
    bcc44b8 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    14a2c8d View commit details
    Browse the repository at this point in the history

Commits on May 3, 2020

  1. Rollup merge of rust-lang#70908 - estebank:suggest-add, r=nikomatsakis

    Provide suggestions for type parameters missing bounds for associated types
    
    When implementing the binary operator traits it is easy to forget to restrict the `Output` associated type. `rustc` now accounts for different cases to lead users in the right direction to add the necessary restrictions. The structured suggestions in the following output are new:
    
    ```
    error: equality constraints are not yet supported in `where` clauses
      --> $DIR/missing-bounds.rs:37:33
       |
    LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
       |                                 ^^^^^^^^^^^^^^^^^^^^^^ not supported
       |
       = note: see issue rust-lang#20041 <rust-lang#20041> for more information
    help: if `Output` is an associated type you're trying to set, use the associated type binding syntax
       |
    LL | impl<B: Add> Add for E<B> where B: Add<Output = B> {
       |                                 ^^^^^^^^^^^^^^^^^
    
    error[E0308]: mismatched types
      --> $DIR/missing-bounds.rs:11:11
       |
    7  | impl<B> Add for A<B> where B: Add {
       |      - this type parameter
    ...
    11 |         A(self.0 + rhs.0)
       |           ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type
       |
       = note: expected type parameter `B`
                 found associated type `<B as std::ops::Add>::Output`
    help: consider further restricting this bound
       |
    7  | impl<B> Add for A<B> where B: Add + std::ops::Add<Output = B> {
       |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0369]: cannot add `B` to `B`
      --> $DIR/missing-bounds.rs:31:21
       |
    31 |         Self(self.0 + rhs.0)
       |              ------ ^ ----- B
       |              |
       |              B
       |
    help: consider restricting type parameter `B`
       |
    27 | impl<B: std::ops::Add<Output = B>> Add for D<B> {
       |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ```
    
    That output is given for the following cases:
    
    ```rust
    struct A<B>(B);
    impl<B> Add for A<B> where B: Add {
        type Output = Self;
    
        fn add(self, rhs: Self) -> Self {
            A(self.0 + rhs.0) //~ ERROR mismatched types
        }
    }
    
    struct D<B>(B);
    impl<B> Add for D<B> {
        type Output = Self;
    
        fn add(self, rhs: Self) -> Self {
            Self(self.0 + rhs.0) //~ ERROR cannot add `B` to `B`
        }
    }
    
    struct E<B>(B);
    impl<B: Add> Add for E<B> where <B as Add>::Output = B {
        type Output = Self;
    
        fn add(self, rhs: Self) -> Self {
            Self(self.0 + rhs.0)
        }
    }
    ```
    Dylan-DPC authored May 3, 2020
    Configuration menu
    Copy the full SHA
    6ad0ab1 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#71165 - lcnr:patch-2, r=Amanieu

    `slice::fill`: use `T` instead of generic arg
    
    implements rust-lang#70758 (comment)
    
    As the discussion in rust-lang#70758 has shifted, I now use `T` instead of `&T`.
    Dylan-DPC authored May 3, 2020
    Configuration menu
    Copy the full SHA
    96a4f13 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#71542 - crlf0710:confusable_idents, r=petro…

    …chenkov
    
    Implement `confusable_idents` lint.
    
    This collects all identifier symbols into `ParseSession` and examines them within the non-ascii-idents lint.
    
    The skeleton generation part needs to be added to `unicode-security` crate. Will update this PR when the crate is updated.
    
    r? @petrochenkov
    
    EDIT: also included the `concat_idents` part.
    Dylan-DPC authored May 3, 2020
    Configuration menu
    Copy the full SHA
    e5be1f8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    167e7d7 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#71813 - ecstatic-morse:issue-71734, r=tmandry

    Decode qualifs for associated const defaults
    
    Fixes rust-lang#71734.
    
    We encode qualifs for associated constants, but never expected to decode the qualifs for defaulted associated consts. Fix this, and test that associated const defaults have the correct qualifs cross-crate.
    
    r? @tmandry
    Dylan-DPC authored May 3, 2020
    Configuration menu
    Copy the full SHA
    18b456b View commit details
    Browse the repository at this point in the history