rust/tests/ui/array-slice-vec
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
..
array_const_index-0.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
array_const_index-0.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
array_const_index-1.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
array_const_index-1.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
array_const_index-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
array-break-length.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
array-break-length.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
array-not-vector.rs Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
array-not-vector.stderr Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
bounds-check-no-overflow.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
box-of-array-of-drop-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
box-of-array-of-drop-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
byte-literals.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
cast-in-array-size.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
check-static-slice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
copy-out-of-array-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
destructure-array-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dst-raw-slice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
empty-mutable-vec.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
estr-slice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
evec-slice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
fixed_length_copy.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
huge-largest-array.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
infer_array_len.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-15730.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-18425.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-69103-extra-binding-subslice.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-69103-extra-binding-subslice.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
ivec-pass-by-value.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
match_arr_unknown_len.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
match_arr_unknown_len.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
mut-vstore-expr.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mutability-inherits-through-fixed-length-vec.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mutable-alias-vec.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
nested-vec-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
nested-vec-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
nested-vec-3.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
new-style-fixed-length-vec.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rcvr-borrowed-to-slice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
repeat_empty_ok.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
repeat_empty_ok.stderr Remove extra # from url 2024-01-24 00:41:45 +01:00
repeated-vector-syntax.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
show-boxed-slice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice_binary_search.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice_is_sorted_by_borrow.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-2.stderr Improve spans for indexing expressions 2023-08-04 13:17:39 +02:00
slice-mut-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-mut-2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
slice-mut.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-mut.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
slice-of-zero-size-elements.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice-panic-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice-panic-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
slice-pat-type-mismatches.rs address review 2023-07-17 22:06:32 +00:00
slice-pat-type-mismatches.stderr address review 2023-07-17 22:06:32 +00:00
slice-to-vec-comparison.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
slice-to-vec-comparison.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
slice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
subslice-only-once-semantic-restriction.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
subslice-only-once-semantic-restriction.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
subslice-patterns-const-eval-match.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
subslice-patterns-const-eval.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
suggest-array-length.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
suggest-array-length.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
suggest-array-length.stderr Bless tests 2024-01-13 12:46:58 -05:00
variance-vec-covariant.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-dst.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-fixed-length.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-late-init.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-macro-no-std.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-macro-rvalue-scope.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-macro-with-brackets.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-macro-with-comma-only.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
vec-macro-with-comma-only.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
vec-macro-with-trailing-comma.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-matching-autoslice.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-matching-fixed.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-matching-fold.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-matching-legal-tail-element-borrow.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-matching.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-mut-iter-borrow.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
vec-mut-iter-borrow.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
vec-overrun.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-repeat-with-cast.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vec-res-add.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
vec-res-add.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
vec-tail-matching.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vector-cast-weirdness.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
vector-cast-weirdness.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
vector-no-ann-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
vector-no-ann.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
vector-no-ann.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00