rust/tests/ui/const-generics/defaults
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
..
auxiliary
complex-generic-default-expr.min.stderr generic_const_exprs: suggest to add the feature, not use it 2023-11-30 20:59:51 +01:00
complex-generic-default-expr.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
complex-unord-param.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
const-default.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
const-param-as-default-value.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
const-param-in-ty-defaults.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
default-annotation.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
default-const-param-cannot-reference-self.rs
default-const-param-cannot-reference-self.stderr
default-on-impl.rs
default-on-impl.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
default-param-wf-concrete.next.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
default-param-wf-concrete.old.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
default-param-wf-concrete.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
doesnt_infer.rs Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
doesnt_infer.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
external.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
forward-declared.rs
forward-declared.stderr
generic-expr-default-concrete.rs
generic-expr-default-concrete.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
generic-expr-default-mismatched-types.rs
generic-expr-default-mismatched-types.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
generic-expr-default.rs
generic-expr-default.stderr Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
intermixed-lifetime.rs
intermixed-lifetime.stderr
mismatch.rs
mismatch.stderr
mismatched_ty_const_in_trait_impl.rs
mismatched_ty_const_in_trait_impl.stderr
param-order-err-pretty-prints-default.rs
param-order-err-pretty-prints-default.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
pretty-printing-ast.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
pretty-printing-ast.stdout [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
repr-c-issue-82792.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
rp_impl_trait_fail.rs Remove a has_errors check that only hides errors after unrelated items have errored. 2024-01-31 16:51:42 +00:00
rp_impl_trait_fail.stderr Remove a has_errors check that only hides errors after unrelated items have errored. 2024-01-31 16:51:42 +00:00
rp_impl_trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
self-referential.rs
self-referential.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
simple-defaults.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trait_object_lt_defaults.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trait_objects_fail.rs
trait_objects_fail.stderr
trait_objects.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
type-default-const-param-name.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
wfness.rs
wfness.stderr
wrong-order.rs
wrong-order.stderr