Repository: rust
Issue: type parameter `impl Sized` (type parameter `impl Sized`)
Labels: A-diagnostics,T-compiler

Given the following code: [[playground]](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=3792730264eb43bb2ce3bd464a9fad6b)

```rust
fn test(mut a: impl Sized, b: impl Sized) {
    a = b;
}
```

The current output is:

```
error[E0308]: mismatched types
 --> src/lib.rs:2:9
  |
1 | fn test(mut a: impl Sized, b: impl Sized) {
  |                ----------     ---------- found type parameter
  |                |
  |                expected type parameter
  |                expected due to this parameter type
2 |     a = b;
  |         ^ expected type parameter `impl Sized`, found a different type parameter `impl Sized`
  |
  = note: expected type parameter `impl Sized` (type parameter `impl Sized`)
             found type parameter `impl Sized` (type parameter `impl Sized`)
  = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
  = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
```

Note specifically

```
  = note: expected type parameter `impl Sized` (type parameter `impl Sized`)
             found type parameter `impl Sized` (type parameter `impl Sized`)
```

The addition of the parenthetical here is not useful. Additionally, this note simply repeats the immediately previous inline span note, but less usefully, since the inline note specifies that the found type is a *different* type parameter.

<details><summary>This error is much more useful for RPIT from distinct functions:</summary>

```
error[E0308]: mismatched types
 --> src/lib.rs:6:9
  |
1 | fn a() -> impl Sized {}
  |           ---------- the expected opaque type
2 | fn b() -> impl Sized {}
  |           ---------- the found opaque type
...
5 |     let mut a = a();
  |                 --- expected due to this value
6 |     a = b();
  |         ^^^ expected opaque type, found a different opaque type
  |
  = note: expected opaque type `impl Sized` (opaque type at <src/lib.rs:1:11>)
             found opaque type `impl Sized` (opaque type at <src/lib.rs:2:11>)
  = note: distinct uses of `impl Trait` result in different opaque types
```

----
</details>

<details><summary>Or even RPIT from different instantiations of the same function:</summary>

```
error[E0308]: mismatched types
 --> src/lib.rs:5:9
  |
1 | fn f<T>() -> impl Sized {}
  |              ----------
  |              |
  |              the expected opaque type
  |              the found opaque type
...
4 |     let mut a = f::<u8>();
  |                 --------- expected due to this value
5 |     a = f::<i8>();
  |         ^^^^^^^^^ expected `u8`, found `i8`
  |
  = note: expected opaque type `impl Sized` (`u8`)
             found opaque type `impl Sized` (`i8`)
```

-----
</details>

Ideally, we'd number the different APITs like:

```
error[E0308]: mismatched types
 --> src/lib.rs:2:9
  |
1 | fn test(mut a: impl Sized, b: impl Sized) {
  |                ----------     ---------- found type parameter #1
  |                |
  |                expected type parameter #0
  |                expected due to this parameter type
2 |     a = b;
  |         ^ expected type parameter `impl Sized`, found a different type parameter `impl Sized`
  |
  = note: expected type parameter `impl Sized` (type parameter #0)
     found another type parameter `impl Sized` (type parameter #1)
  = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
  = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
```

but the existing parentheticals are useless and even just dropping them would improve the error.