rust/compiler
Guillaume Gomez 0e5e04b89a
Rollup merge of #116250 - estebank:closure-arg-inference-span, r=petrochenkov
On type error of closure call argument, point at earlier calls that affected inference

Mitigate part of  https://github.com/rust-lang/rust/issues/71209.

When we encounter a type error on a specific argument of a closure call argument, where the closure's definition doesn't have a type specified, look for other calls of the closure to try and find the specific call that cased that argument to be inferred of the expected type.

```
error[E0308]: mismatched types
  --> $DIR/unboxed-closures-type-mismatch.rs:30:18
   |
LL |         identity(1u16);
   |         -------- ^^^^ expected `u8`, found `u16`
   |         |
   |         arguments to this function are incorrect
   |
note: expected because the closure was earlier called with an argument of type `u8`
  --> $DIR/unboxed-closures-type-mismatch.rs:29:18
   |
LL |         identity(1u8);
   |         -------- ^^^ expected because this argument is of type `u8`
   |         |
   |         in this closure call
note: closure parameter defined here
  --> $DIR/unboxed-closures-type-mismatch.rs:28:25
   |
LL |         let identity = |x| x;
   |                         ^
help: change the type of the numeric literal from `u16` to `u8`
   |
LL |         identity(1u8);
   |                   ~~
```
2023-10-10 18:44:44 +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 Remove unnecessary features from rustc_abi 2023-10-04 11:43:57 +02:00
rustc_arena Remove the `TypedArena::alloc_from_iter` specialization. 2023-10-03 18:12:08 +11:00
rustc_ast Rollup merge of #116223 - catandcoder:master, r=cjgillot 2023-10-05 00:56:29 -07:00
rustc_ast_lowering Rollup merge of #116431 - estebank:issue-80476, r=compiler-errors 2023-10-05 00:56:30 -07:00
rustc_ast_passes Rollup merge of #116393 - compiler-errors:auto-bad, r=WaffleLapkin 2023-10-04 05:02:07 +02:00
rustc_ast_pretty Move let expression checking to parsing 2023-09-11 15:51:18 +00:00
rustc_attr Factor out `insert_or_error`. 2023-10-06 14:57:09 +11:00
rustc_baked_icu_data
rustc_borrowck Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiser 2023-10-06 18:44:32 +00:00
rustc_builtin_macros Don't `escape_debug` the condition of `assert!`. 2023-10-10 09:08:11 +11:00
rustc_codegen_cranelift Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into sync_cg_clif-2023-10-09 2023-10-09 08:52:46 +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 Make FnDef 1-ZST in LLVM debuginfo. 2023-10-08 16:42:45 +00:00
rustc_codegen_ssa Auto merge of #116454 - tmiasko:small-dominators, r=cjgillot 2023-10-08 12:38:14 +00:00
rustc_const_eval Auto merge of #116551 - RalfJung:nondet-nan, r=oli-obk 2023-10-10 11:42:27 +00:00
rustc_data_structures Optimize dominators for small path graphs 2023-10-05 23:45:59 +02:00
rustc_driver Update rustix 2023-07-03 07:20:51 +00:00
rustc_driver_impl rustc_driver: avoid fallible conversions 2023-10-06 08:54:14 -04:00
rustc_error_codes Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiser 2023-10-06 18:44:32 +00:00
rustc_error_messages Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rustc_errors Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
rustc_expand Add two setter functions to `Features`. 2023-10-05 18:01:11 +11:00
rustc_feature Use a closure when setting `State::Active`. 2023-10-05 19:56:19 +11:00
rustc_fluent_macro Factor out common token generation in `fluent_messages`. 2023-10-02 16:47:10 +11:00
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 Rollup merge of #116537 - gurry:116473-ice-sugg-overlap, r=compiler-errors 2023-10-09 16:26:01 +02:00
rustc_hir_pretty Record asyncness span in HIR 2023-09-21 19:18:14 +00:00
rustc_hir_typeck Rollup merge of #116250 - estebank:closure-arg-inference-span, r=petrochenkov 2023-10-10 18:44:44 +02:00
rustc_incremental Don't use a thread to load the dep graph 2023-09-24 00:30:43 +02:00
rustc_index Preserve DebugInfo in DeadStoreElimination. 2023-10-06 15:46:11 +00:00
rustc_infer remove trailing dots 2023-10-08 10:06:17 +00:00
rustc_interface Don't use a thread to load the dep graph 2023-09-24 00:30:43 +02:00
rustc_lexer Update lexer emoji diagnostics to Unicode 15.0 2023-07-29 08:47:21 +08:00
rustc_lint Rollup merge of #116421 - Urgau:inter-mut-invalid_ref_casting, r=oli-obk 2023-10-06 06:23:48 +02:00
rustc_lint_defs Remove `rustc_lint_defs::lint_array` 2023-09-28 23:01:25 +02:00
rustc_llvm fix to register analysis pass from llvm plugin 2023-10-06 12:04:28 +00:00
rustc_log use env variable to control thread ids in rustc_log 2023-10-10 09:39:47 +08:00
rustc_macros Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
rustc_metadata rustc_metadata: use try_canonicalize 2023-10-06 09:54:12 -04:00
rustc_middle Auto merge of #116497 - compiler-errors:impl-span, r=cjgillot 2023-10-09 21:03:41 +00:00
rustc_mir_build Auto merge of #116427 - cjgillot:no-internal, r=oli-obk 2023-10-05 09:59:14 +00:00
rustc_mir_dataflow Preserve DebugInfo in DeadStoreElimination. 2023-10-06 15:46:11 +00:00
rustc_mir_transform Rollup merge of #116595 - RalfJung:mir-enable-passes, r=oli-obk 2023-10-10 14:07:48 +02:00
rustc_monomorphize rustc_monomorphize: Introduce check_fn_args_move_size() 2023-10-07 10:29:37 +02:00
rustc_parse Rollup merge of #116400 - estebank:issue-78585, r=WaffleLapkin 2023-10-06 16:37:47 -07: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 Account for macros 2023-10-09 22:48:10 +00:00
rustc_plugin_impl
rustc_privacy Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00
rustc_query_impl Remove unneeded dependency. 2023-10-06 14:57:09 +11:00
rustc_query_system Rollup merge of #115863 - chenyukang:yukang-add-message-tidy-check, r=davidtwco 2023-10-03 12:24:11 +02:00
rustc_resolve Rename `Resolver::active_features`. 2023-10-05 18:01:11 +11:00
rustc_serialize Use `collect` to decode `Vec`. 2023-10-06 10:30:03 +11:00
rustc_session Rollup merge of #116595 - RalfJung:mir-enable-passes, r=oli-obk 2023-10-10 14:07:48 +02:00
rustc_smir return crates instead of a crate 2023-10-09 10:33:23 +03:00
rustc_span Rollup merge of #116474 - nnethercote:rustc_assorted, r=spastorino 2023-10-06 21:17:50 +02:00
rustc_symbol_mangling Remove span from BrAnon. 2023-09-24 09:46:55 +00:00
rustc_target linker: Remove unstable legacy CLI linker flavors 2023-10-07 21:57:53 +03:00
rustc_trait_selection Rollup merge of #116596 - lcnr:normalize-subdir, r=compiler-errors 2023-10-10 14:07:48 +02:00
rustc_traits Detect cycle errors hidden by opaques during monomorphization 2023-09-13 17:35:44 +00:00
rustc_transmute Remove the `MaybeTransmutableQuery<&'l Dfa<...>, C>` impl. 2023-10-06 11:25:32 +11:00
rustc_ty_utils Auto merge of #116269 - Veykril:rustc-abi, r=WaffleLapkin 2023-10-06 00:03:56 +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 return crates instead of a crate 2023-10-09 10:33:23 +03:00