rust/compiler
Esteban Küber 796be88062 Use fn ptr signature instead of {closure@..} in infer error
When suggesting a type on inference error, do not use `{closure@..}`.
Instead, replace with an appropriate `fn` ptr.

On the error message, use `short_ty_string` and write long types to
disk.

```
error[E0284]: type annotations needed for `Select<{closure@lib.rs:2782:13}, _, Expression<'_>, _>`
  --> crates/lang/src/parser.rs:41:13
   |
41 |         let lit = select! {
   |             ^^^
42 |             Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()),
   |                                                                                                  ---- type must be known at this point
   |
   = note: the full type name has been written to '/home/gh-estebank/iowo/target/debug/deps/lang-e2d6e25819442273.long-type-4587393693885174369.txt'
   = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan`
help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified
   |
41 |         let lit: Select<for<'a, 'b> fn(tokens::Token<'_>, &'a mut MapExtra<'_, 'b, _, _>) -> Option<Expression<'_>>, _, Expression<'_>, _> = select! {
   |                +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
```

instead of

```
error[E0284]: type annotations needed for `Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _>`
  --> crates/lang/src/parser.rs:41:13
   |
41 |         let lit = select! {
   |             ^^^
42 |             Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()),
   |                                                                                                  ---- type must be known at this point
   |
   = note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan`
help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified
   |
41 |         let lit: Select<{closure@/home/gh-estebank/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, _, Expression<'_>, _> = select! {
   |                ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
```

Fix #123630.
2024-04-10 00:41:27 +00:00
..
rustc
rustc_abi Use the Align type when parsing alignment attributes 2024-04-01 03:05:55 +01:00
rustc_arena rename ptr::invalid -> ptr::without_provenance 2024-02-21 20:15:52 +01:00
rustc_ast Rollup merge of #123397 - krtab:foreign_fn_qualif_diag, r=petrochenkov 2024-04-04 14:51:17 +02:00
rustc_ast_ir Fix typo in VisitorResult 2024-03-08 23:20:29 -05:00
rustc_ast_lowering hir: Use ItemLocalId in a couple more places 2024-04-04 14:43:49 +03:00
rustc_ast_passes Rollup merge of #123397 - krtab:foreign_fn_qualif_diag, r=petrochenkov 2024-04-04 14:51:17 +02:00
rustc_ast_pretty Auto merge of #123080 - Jules-Bertholet:mut-ref-mut, r=Nadrieril 2024-03-29 11:08:11 +00:00
rustc_attr Use the Align type when parsing alignment attributes 2024-04-01 03:05:55 +01:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #123419 - petrochenkov:zeroindex, r=compiler-errors 2024-04-03 22:11:02 +02:00
rustc_builtin_macros Fix error message for env! when env var is not valid Unicode 2024-04-01 05:44:45 +01:00
rustc_codegen_cranelift Auto merge of #123221 - pacak:cache_emit, r=fmease,jieyouxu 2024-04-07 10:46:50 +00:00
rustc_codegen_gcc Save/restore more items in cache with incremental compilation 2024-04-06 10:59:24 -04:00
rustc_codegen_llvm Save/restore more items in cache with incremental compilation 2024-04-06 10:59:24 -04:00
rustc_codegen_ssa Auto merge of #123221 - pacak:cache_emit, r=fmease,jieyouxu 2024-04-07 10:46:50 +00:00
rustc_const_eval Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
rustc_data_structures rustc_index: Add a ZERO constant to index types 2024-04-03 19:06:22 +03:00
rustc_driver
rustc_driver_impl Auto merge of #111769 - saethlin:ctfe-backtrace-ctrlc, r=RalfJung 2024-03-26 00:04:03 +00:00
rustc_error_codes Auto merge of #122055 - compiler-errors:stabilize-atb, r=oli-obk 2024-03-19 00:04:09 +00:00
rustc_error_messages Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_errors Rollup merge of #123401 - Zalathar:assert-size-aarch64, r=fmease 2024-04-03 20:17:06 -04:00
rustc_expand Check x86_64 size assertions on aarch64, too 2024-04-03 16:53:03 +11:00
rustc_feature Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
rustc_fluent_macro Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_fs_util Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_graphviz Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_hir explaining DefKind::Field 2024-04-05 23:12:43 +08:00
rustc_hir_analysis cache type info for ParamEnv 2024-04-04 18:33:38 +02:00
rustc_hir_pretty Implement mut ref/mut ref mut 2024-03-27 09:53:23 -04:00
rustc_hir_typeck Rollup merge of #123526 - estebank:issue-123442, r=compiler-errors 2024-04-06 08:56:36 +02:00
rustc_incremental Auto merge of #122070 - Zoxc:dep-edges-from-previous, r=cjgillot 2024-04-05 11:11:17 +00:00
rustc_index Check x86_64 size assertions on aarch64, too 2024-04-03 16:53:03 +11:00
rustc_index_macros rustc_index: Add a ZERO constant to index types 2024-04-03 19:06:22 +03:00
rustc_infer Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
rustc_interface Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
rustc_lexer Silence redundant error on char literal that was meant to be a string in 2021 edition 2024-03-17 23:35:19 +00:00
rustc_lint Put non_local_definitions lint back to warn-by-default 2024-04-05 19:25:58 +02:00
rustc_lint_defs rename expose_addr to expose_provenance 2024-04-03 16:00:38 +02:00
rustc_llvm Rollup merge of #123294 - Nilstrieb:reuqire-llvm-config, r=clubby789 2024-04-06 08:56:33 +02:00
rustc_log bump tracing-tree to 0.3 2024-03-30 17:39:43 +03:00
rustc_macros Rename diagnostic derive things. 2024-03-11 10:06:34 +11:00
rustc_metadata Replace RemapFileNameExt::for_codegen with explicit calls 2024-03-28 18:47:26 +01:00
rustc_middle Auto merge of #123058 - lukas-code:clauses, r=lcnr 2024-04-07 02:07:20 +00:00
rustc_mir_build Rollup merge of #123311 - Jules-Bertholet:andpat-everywhere, r=Nadrieril 2024-04-05 16:38:50 +02:00
rustc_mir_dataflow rustc_index: Add a ZERO constant to index types 2024-04-03 19:06:22 +03:00
rustc_mir_transform Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
rustc_monomorphize Only allow upstream calls to LLVM intrinsics, not any link_name function 2024-04-01 20:31:19 -04:00
rustc_next_trait_solver Require foldability part of interner item bounds, remove redundant where clauses 2024-03-28 12:30:52 -04:00
rustc_parse Rollup merge of #123401 - Zalathar:assert-size-aarch64, r=fmease 2024-04-03 20:17:06 -04:00
rustc_parse_format Check x86_64 size assertions on aarch64, too 2024-04-03 16:53:03 +11:00
rustc_passes Do not ICE on field access check on expr with ty::Error 2024-04-06 16:34:57 +00:00
rustc_pattern_analysis Fix union handling in exhaustiveness 2024-04-01 00:01:46 +02:00
rustc_privacy Rename hir::Local into hir::LetStmt 2024-03-22 20:36:21 +01:00
rustc_query_impl Verify that query keys result in unique dep nodes 2024-03-12 05:31:41 +01:00
rustc_query_system Remove sharding for VecCache 2024-04-06 10:49:31 -04:00
rustc_resolve Rollup merge of #123307 - tgross35:f16-f128-feature-gate-fix, r=petrochenkov 2024-04-03 20:17:05 -04:00
rustc_serialize Stabilize associated type bounds 2024-03-08 20:56:25 +00:00
rustc_session Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
rustc_smir rename expose_addr to expose_provenance 2024-04-03 16:00:38 +02:00
rustc_span Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00
rustc_symbol_mangling Rollup merge of #123525 - maurer:no-id-dyn2, r=compiler-errors 2024-04-06 08:56:35 +02:00
rustc_target Rollup merge of #123446 - crazytonyli:fix-watchos-llvm-target, r=estebank 2024-04-07 09:17:15 +02:00
rustc_trait_selection Add a debug asserts call to match_projection_projections to ensure invariant 2024-04-06 14:45:48 -03:00
rustc_traits Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
rustc_transmute Remove unnecessary Partial/Ord derive 2024-03-27 14:02:15 +00:00
rustc_ty_utils Rollup merge of #123464 - fmease:rn-has-proj-to-has-aliases, r=compiler-errors 2024-04-04 21:16:58 -04:00
rustc_type_ir Auto merge of #123058 - lukas-code:clauses, r=lcnr 2024-04-07 02:07:20 +00:00
stable_mir Put checks that detect UB under their own flag below debug_assertions 2024-04-06 11:21:47 -04:00