]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #106752 - sulami:master, r=estebank
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 14 Jan 2023 12:04:26 +0000 (13:04 +0100)
committerGitHub <noreply@github.com>
Sat, 14 Jan 2023 12:04:26 +0000 (13:04 +0100)
commit108b5f462b0c1845253002c3d4b615a11a844cb8
tree81ac3c88a811ee2e04f2639087a7590d75b7cdf8
parent3fa9be9094e5412afeea05ce5ed821700809d0d2
parenta3cf3822d267524e3d9fa45309f2718793f3cf7f
Rollup merge of #106752 - sulami:master, r=estebank

Emit a hint for bad call return types due to generic arguments

When the return type of a function call depends on the type of an argument, e.g.

```
fn foo<T>(x: T) -> T {
    x
}
```

and the expected type is set due to either an explicitly typed binding, or because the call to the function is in a tail position without semicolon, the current error implies that the argument in the call has the wrong type.

This new hint highlights that the expected type doesn't match the returned type, which matches the argument type, and that that's why we're flagging the argument type.

Fixes #43608.