mirror of
https://github.com/rust-lang/rust.git
synced 2026-03-19 12:49:33 +00:00
hir_typeck: be more conservative in making "note caller chooses ty param" note In https://github.com/rust-lang/rust/pull/122195 I added a "caller chooses ty for type param" note for when the return expression type a.k.a. found type does not match the expected return type. #126547 found that this note was confusing when the found return type *contains* the expected type, e.g. ```rs fn f<T>(t: &T) -> T { t } ``` because the found return type `&T` will *always* be different from the expected return type `T`, so the note was needlessly redundant and confusing. This PR addresses that by not making the note if the found return type contains the expected return type. r? ``@fmease`` (since you reviewed the original PR) Fixes https://github.com/rust-lang/rust/issues/126547