rust/compiler
许杰友 Jieyou Xu (Joe) bf841c4773
Rollup merge of #126558 - jieyouxu:caller-chooses-ty, r=fmease
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
2024-06-19 01:51:41 +01:00
..
rustc Change SIGPIPE ui from #[unix_sigpipe = "..."] to -Zon-broken-pipe=... 2024-05-02 19:48:29 +02:00
rustc_abi Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_arena Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_ast Rollup merge of #124135 - petrochenkov:deleglob, r=fmease 2024-06-19 01:51:36 +01:00
rustc_ast_ir Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_ast_lowering Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco 2024-06-19 01:51:38 +01:00
rustc_ast_passes Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_ast_pretty Rollup merge of #124135 - petrochenkov:deleglob, r=fmease 2024-06-19 01:51:36 +01:00
rustc_attr Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_baked_icu_data Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_borrowck Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
rustc_builtin_macros Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_codegen_cranelift Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_codegen_gcc Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
rustc_codegen_llvm Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
rustc_codegen_ssa Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_const_eval Rollup merge of #126493 - jswrenn:fix-126460, r=compiler-errors 2024-06-19 01:51:39 +01:00
rustc_data_structures Use Linux file locking on Redox 2024-06-16 12:56:50 +00:00
rustc_driver Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_driver_impl Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_error_codes Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubilee 2024-06-12 11:10:50 +00:00
rustc_error_messages Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_errors Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
rustc_expand Rollup merge of #124135 - petrochenkov:deleglob, r=fmease 2024-06-19 01:51:36 +01:00
rustc_feature Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco 2024-06-19 01:51:38 +01:00
rustc_fluent_macro Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_fs_util Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_graphviz Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_hir Rework precise capturing syntax 2024-06-17 22:35:25 -04:00
rustc_hir_analysis Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco 2024-06-19 01:51:38 +01:00
rustc_hir_pretty Rework precise capturing syntax 2024-06-17 22:35:25 -04:00
rustc_hir_typeck hir_typeck: be more conservative in making "note caller chooses ty param" note 2024-06-18 21:05:59 +00:00
rustc_incremental Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_index Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_index_macros rustc_span: Minor improvements 2024-06-16 14:08:25 +03:00
rustc_infer Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnr 2024-06-18 19:41:33 +00:00
rustc_interface Auto merge of #126623 - oli-obk:do_not_count_errors, r=davidtwco 2024-06-18 16:49:19 +00:00
rustc_lexer Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_lint Rollup merge of #126422 - Urgau:doctest-impl-non-local-def, r=fmease 2024-06-19 01:51:39 +01:00
rustc_lint_defs Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope 2024-06-14 11:05:35 -04:00
rustc_llvm Auto merge of #125141 - SergioGasquez:feat/no_std-xtensa, r=davidtwco 2024-06-12 13:43:31 +00:00
rustc_log Bump tracing-tree and allow rendering lines again 2024-06-12 10:11:41 +00:00
rustc_macros Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
rustc_metadata Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_middle Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnr 2024-06-18 19:41:33 +00:00
rustc_mir_build Remove redundant argument from subdiagnostic method 2024-06-18 15:42:11 +00:00
rustc_mir_dataflow Use is_lang_item more aggressively 2024-06-14 16:54:29 -04:00
rustc_mir_transform Auto merge of #126623 - oli-obk:do_not_count_errors, r=davidtwco 2024-06-18 16:49:19 +00:00
rustc_monomorphize Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_next_trait_solver Fix transmute goal 2024-06-18 11:04:01 -04:00
rustc_parse Rollup merge of #124135 - petrochenkov:deleglob, r=fmease 2024-06-19 01:51:36 +01:00
rustc_parse_format Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_passes Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_pattern_analysis Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_privacy Do not ICE in privacy when type inference fails. 2024-06-17 10:09:27 +00:00
rustc_query_impl Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_query_system Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_resolve Rollup merge of #124135 - petrochenkov:deleglob, r=fmease 2024-06-19 01:51:36 +01:00
rustc_sanitizers Rename InstanceDef -> InstanceKind 2024-06-16 21:35:21 -04:00
rustc_serialize Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_session Auto merge of #126623 - oli-obk:do_not_count_errors, r=davidtwco 2024-06-18 16:49:19 +00:00
rustc_smir Rename InstanceDef -> InstanceKind 2024-06-16 21:35:21 -04:00
rustc_span Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco 2024-06-19 01:51:38 +01:00
rustc_symbol_mangling Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
rustc_target Add i686-unknown-redox target 2024-06-16 12:56:48 +00:00
rustc_trait_selection Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnr 2024-06-18 19:41:33 +00:00
rustc_traits Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_transmute safe transmute: support non-ZST, variantful, uninhabited enums 2024-06-14 21:11:08 +00:00
rustc_ty_utils Rename InstanceDef -> InstanceKind 2024-06-16 21:35:21 -04:00
rustc_type_ir Fix transmute goal 2024-06-18 11:04:01 -04:00
rustc_type_ir_macros Uplift TraitPredicate 2024-05-11 18:20:00 -04:00
stable_mir Rollup merge of #126410 - RalfJung:smir-const-operand, r=oli-obk 2024-06-15 19:51:35 +02:00