Skip to content

Commit

Permalink
Rollup merge of rust-lang#122195 - jieyouxu:impl-return-note, r=fmease
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr authored Mar 22, 2024
2 parents 879899c + f9a9c4b commit 1c37a23
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/ui/builtin_type_shadow.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ LL | 42
|
= note: expected type parameter `u32`
found type `{integer}`
= note: the caller chooses a type for `u32` which can be different from `i32`

error: aborting due to 2 previous errors

Expand Down

0 comments on commit 1c37a23

Please sign in to comment.