rust/compiler
bors 0f529f0f49 Auto merge of #102813 - Akida31:issue-64915/simpler_diagnostic_when_passing_arg_to_closure_and_missing_borrow, r=estebank
Simpler diagnostic when passing arg to closure and missing borrow

fixes #64915

I followed roughly the instructions and the older PR #76362.
The number of references for the expected and the found types will be compared and depending on which has more the diagnostic will be emitted.

I'm not quite sure if my approach with the many `span_bug!`s is good, it could lead to some ICEs. Would it be better if  those errors are ignored?

As far as I know the following code works similarly but in a different context. Is this probably reusable since it looks like it would emit better diagnostics?
a688a0305f/compiler/rustc_hir_analysis/src/check/demand.rs (L713-L1061)

When running the tests locally, a codegen test failed. Is there something I can/ should do about that?

If you have some improvements/ corrections please say so and I will happily include them.

r? `@estebank` (as you added the mentoring instructions to the issue)
2022-12-13 18:46:35 +00:00
..
rustc rustc: Use unix_sigpipe instead of rustc_driver::set_sigpipe_handler 2022-10-02 17:49:36 +02:00
rustc_abi minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_ast Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors 2022-12-13 01:17:10 +01:00
rustc_ast_lowering Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_ast_passes remove unnecessary uses of clone 2022-12-13 02:06:24 +09:00
rustc_ast_pretty Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_attr rustc_attr remove ref patterns 2022-12-06 14:45:58 +00:00
rustc_baked_icu_data Update crate documentation of rustc_baked_icu_data crate 2022-11-18 14:46:36 -08:00
rustc_borrowck remove unnecessary uses of clone 2022-12-13 02:06:24 +09:00
rustc_builtin_macros Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors 2022-12-13 01:17:10 +01:00
rustc_codegen_cranelift bug! with a better error message for failing Instance::resolve 2022-12-11 19:48:24 +00:00
rustc_codegen_gcc Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa 2022-12-12 10:38:31 +00:00
rustc_codegen_llvm Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors 2022-12-13 01:17:10 +01:00
rustc_codegen_ssa Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa 2022-12-12 10:38:31 +00:00
rustc_const_eval Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-dead 2022-12-11 09:51:57 +01:00
rustc_data_structures minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_driver compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_error_codes compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_error_messages Migrate parts of rustc_expand to session diagnostics 2022-12-10 11:02:41 +01:00
rustc_errors Rollup merge of #105625 - matthiaskrgr:clippy_dec12, r=compiler-errors 2022-12-13 01:17:10 +01:00
rustc_expand Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_feature Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3 2022-12-10 09:24:43 +01:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_hir minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_hir_analysis Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-dead 2022-12-11 09:51:57 +01:00
rustc_hir_pretty Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_hir_typeck Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_incremental compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_index minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_infer Auto merge of #105350 - compiler-errors:faster-binder-relate, r=oli-obk 2022-12-13 07:10:53 +00:00
rustc_interface compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_lexer minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_lint Speed up the "builtin lints only" case. 2022-12-12 08:59:27 +11:00
rustc_lint_defs delete mentions of type ascription from lint descriptions 2022-12-12 17:43:15 +01:00
rustc_llvm llvm-wrapper: adapt for LLVM API changes 2022-12-11 09:14:50 +00:00
rustc_log Use IsTerminal in rustc_log 2022-10-16 15:10:40 +01:00
rustc_macros Auto merge of #105220 - oli-obk:feeding, r=cjgillot 2022-12-06 03:47:41 +00:00
rustc_metadata Rollup merge of #105472 - spastorino:make-encoder-use-queries, r=oli-obk 2022-12-11 23:36:46 +01:00
rustc_middle Auto merge of #105612 - oli-obk:bind_rustdoc, r=GuillaumeGomez 2022-12-13 13:09:40 +00:00
rustc_mir_build Rollup merge of #105615 - WaffleLapkin:remove_opt_scope_span_mention, r=compiler-errors 2022-12-12 19:20:36 +01:00
rustc_mir_dataflow Auto merge of #105436 - nnethercote:inline-place_contents_drop_state_cannot_differ, r=spastorino 2022-12-13 03:28:57 +00:00
rustc_mir_transform Rollup merge of #105537 - kadiwa4:remove_some_imports, r=fee1-dead 2022-12-11 09:51:57 +01:00
rustc_monomorphize bug! with a better error message for failing Instance::resolve 2022-12-11 19:48:24 +00:00
rustc_parse Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov 2022-12-12 05:16:50 +00:00
rustc_parse_format Assert size of rustc_parse_format::Piece<'_> 2022-12-08 22:50:39 +00:00
rustc_passes Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obk 2022-12-07 15:39:06 +01:00
rustc_plugin_impl Migrate all diagnostics 2022-10-23 10:09:44 +02:00
rustc_privacy drive-by: move field_index to typeck results 2022-12-04 17:59:21 +00:00
rustc_query_impl Auto merge of #104940 - cjgillot:query-feed-simple, r=oli-obk 2022-11-30 17:20:14 +00:00
rustc_query_system compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_resolve Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebank 2022-12-13 01:17:08 +01:00
rustc_save_analysis compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_serialize compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_session compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_smir Only keep one version of ImplicitSelfKind. 2022-09-13 19:18:23 +02:00
rustc_span minor code cleanups 2022-12-12 19:49:53 +01:00
rustc_symbol_mangling Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3 2022-12-10 09:24:43 +01:00
rustc_target compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_trait_selection tidy: ignore filelength 2022-12-13 16:37:44 +01:00
rustc_traits Move some suggestions from error_reporting to error_reporting::suggest 2022-12-08 05:58:30 +00:00
rustc_transmute Auto merge of #103831 - chenyukang:yukang/fix-103751-ice, r=nagisa 2022-11-05 13:48:30 +00:00
rustc_ty_utils normalize receiver substs and erase the regions 2022-12-12 22:16:51 +09:00
rustc_type_ir compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00