rust/compiler
Matthias Krüger 634e5c9ba2
Rollup merge of #116158 - compiler-errors:unconstrained-type-var-sugg, r=wesleywiser
Don't suggest nonsense suggestions for unconstrained type vars in `note_source_of_type_mismatch_constraint`

The way we do type inference for suggestions in `note_source_of_type_mismatch_constraint` is a bit strange. We compute the "ideal" method signature, which takes the receiver that we *want* and uses it to compute the types of the arguments that would have given us that receiver via type inference, and use *that* to suggest how to change an argument to make sure our receiver type is inferred correctly.

The problem is that sometimes we have totally unconstrained arguments (well, they're constrained by things outside of the type checker per se, like associated types), and therefore type suggestions are happy to coerce anything to that unconstrained argument. This leads to bogus suggestions, like #116155. This is partly due to above, and partly due to the fact that `emit_type_mismatch_suggestions` doesn't double check that its suggestions are actually compatible with the program other than trying to satisfy the type mismatch.

This adds a hack to make sure that at least the types are fully constrained, but I guess I could also rip out this logic altogether. There would be some sad diagnostics regressions though, such as `tests/ui/type/type-check/point-at-inference-4.rs`.

Fixes #116155
2023-10-03 08:58:48 +02:00
..
rustc Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things 2023-09-25 14:38:27 +00:00
rustc_abi Name some local variables more consistently. 2023-10-02 09:12:47 +11:00
rustc_arena Inline and remove DroplessArena::alloc_raw_without_grow. 2023-09-28 17:58:56 +10:00
rustc_ast Factor out the two entry_point_type functions. 2023-10-01 20:45:09 +11:00
rustc_ast_lowering subst -> instantiate 2023-09-26 09:37:55 +02:00
rustc_ast_passes Add comment about RTN feature gating 2023-09-24 10:47:57 +02:00
rustc_ast_pretty Move let expression checking to parsing 2023-09-11 15:51:18 +00:00
rustc_attr Auto merge of #114201 - Centri3:explicit-repr-rust, r=WaffleLapkin 2023-08-25 00:02:54 +00:00
rustc_baked_icu_data
rustc_borrowck fix clippy::{redundant_guards, useless_format} 2023-09-27 23:49:15 +02:00
rustc_builtin_macros Factor out the two entry_point_type functions. 2023-10-01 20:45:09 +11:00
rustc_codegen_cranelift Auto merge of #115898 - onur-ozkan:config-change-tracking, r=Mark-Simulacrum 2023-10-02 07:41:52 +00:00
rustc_codegen_gcc Auto merge of #102099 - InnovativeInventor:re-cold-land, r=nikic 2023-10-02 22:02:12 +00:00
rustc_codegen_llvm Limit to LLVM 17.0.2 to work around WinEH codegen bug 2023-10-02 11:06:38 +02:00
rustc_codegen_ssa Reapply: Mark drop calls in landing pads cold instead of noinline 2023-10-02 10:37:53 +02:00
rustc_const_eval Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrum 2023-10-01 05:56:47 +00:00
rustc_data_structures Rename cold_path to outline 2023-09-25 22:54:07 +02:00
rustc_driver
rustc_driver_impl Auto merge of #115627 - compiler-errors:icedump-no-std, r=m-ou-se 2023-09-19 16:56:25 +00:00
rustc_error_codes Auto merge of #115659 - compiler-errors:itp, r=cjgillot 2023-09-28 21:35:18 +00:00
rustc_error_messages Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rustc_errors Auto merge of #115690 - ShE3py:Z-treat-err-as-bug, r=petrochenkov 2023-09-22 13:01:30 +00:00
rustc_expand Enable incremental-relative-spans by default. 2023-09-07 20:21:13 +00:00
rustc_feature Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrum 2023-10-01 05:56:47 +00:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrum 2023-10-01 05:56:47 +00:00
rustc_hir_analysis Auto merge of #115933 - oli-obk:simd_shuffle_const, r=workingjubilee 2023-09-30 04:05:26 +00:00
rustc_hir_pretty Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
rustc_hir_typeck Don't suggest nonsense suggestions for unconstrained type vars in note_source_of_type_mismatch_constraint 2023-10-02 21:13:46 +00:00
rustc_incremental Don't use a thread to load the dep graph 2023-09-24 00:30:43 +02:00
rustc_index Auto merge of #115094 - Mark-Simulacrum:bootstrap-update, r=ozkanonur 2023-08-24 11:10:52 +00:00
rustc_infer fix clippy::{redundant_guards, useless_format} 2023-09-27 23:49:15 +02:00
rustc_interface Don't use a thread to load the dep graph 2023-09-24 00:30:43 +02:00
rustc_lexer
rustc_lint Rollup merge of #116231 - DaniPopes:simpler-lint-array, r=Nilstrieb 2023-09-29 10:11:13 +02:00
rustc_lint_defs Remove rustc_lint_defs::lint_array 2023-09-28 23:01:25 +02:00
rustc_llvm Pass name of object file to LLVM so it can correctly emit S_OBJNAME 2023-09-25 19:31:58 +02:00
rustc_log
rustc_macros Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rustc_metadata Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00
rustc_middle skip_binder to instantiate_identity 2023-10-02 13:19:37 +02:00
rustc_mir_build Move eval_bits optimization upstream 2023-10-01 21:12:24 +02:00
rustc_mir_dataflow Some tracing cleanups 2023-09-28 16:13:37 +00:00
rustc_mir_transform Auto merge of #115759 - oli-obk:open_drop_from_non-ADT, r=lcnr 2023-09-29 11:59:51 +00:00
rustc_monomorphize Auto merge of #116163 - compiler-errors:lazyness, r=oli-obk 2023-09-27 01:48:53 +00:00
rustc_parse Tweak wording of missing angle backets in qualified path 2023-09-28 00:37:20 +00:00
rustc_parse_format Rollup merge of #115611 - lukas-code:format!("{r#ident}"), r=compiler-errors 2023-09-17 11:23:25 +00:00
rustc_passes Factor out the two entry_point_type functions. 2023-10-01 20:45:09 +11:00
rustc_plugin_impl
rustc_privacy Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00
rustc_query_impl Move DepKind to rustc_query_system and define it as u16 2023-09-21 17:06:14 +02:00
rustc_query_system Auto merge of #116163 - compiler-errors:lazyness, r=oli-obk 2023-09-27 01:48:53 +00:00
rustc_resolve Rollup merge of #114454 - Nilstrieb:no-evil-sorting, r=cjgillot 2023-10-02 16:09:42 -04:00
rustc_serialize Open the FileEncoder file for reading and writing 2023-09-22 16:13:25 -04:00
rustc_session Enable drop_tracking_mir by default. 2023-09-23 13:34:09 +00:00
rustc_smir remove unimplemented 2023-09-28 19:52:41 +03:00
rustc_span Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrum 2023-10-01 05:56:47 +00:00
rustc_symbol_mangling Remove span from BrAnon. 2023-09-24 09:46:55 +00:00
rustc_target Auto merge of #116076 - chriswailes:android-riscv-extension-update, r=cjgillot 2023-09-24 11:40:45 +00:00
rustc_trait_selection Point out the actual mismatch error 2023-10-02 23:14:29 +00:00
rustc_traits Detect cycle errors hidden by opaques during monomorphization 2023-09-13 17:35:44 +00:00
rustc_transmute make the eval() functions on our const types return the resulting value 2023-09-13 07:29:34 +02:00
rustc_ty_utils Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00
rustc_type_ir Auto merge of #116069 - compiler-errors:debug-tuple, r=Nilstrieb 2023-09-24 15:16:18 +00:00
stable_mir Rollup merge of #116024 - ouz-a:smir_region, r=oli-obk 2023-09-29 22:27:50 +02:00