os-rust/tests/ui/generic-const-items
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
..
assoc-const-AnonConst-ice-108220.rs add test for ICE with associated_const_equality #108220 2024-03-24 10:28:25 +01:00
assoc-const-no-infer-ice-115806.rs add test for assertion failed: !value.has_infer() #115806 2024-04-07 01:45:31 +02:00
assoc-const-no-infer-ice-115806.stderr add test for assertion failed: !value.has_infer() #115806 2024-04-07 01:45:31 +02:00
associated-const-equality.rs Propagate the resolved type of assoc const bindings via query feeding 2024-02-18 10:29:22 +01:00
basic.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
compare-impl-item.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
compare-impl-item.stderr Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
const-trait-impl.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
duplicate-where-clause.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
duplicate-where-clause.stderr Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
elided-lifetimes.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
elided-lifetimes.stderr Provide structured suggestion for #![feature(foo)] 2024-03-18 16:08:58 +00:00
evaluatable-bounds.fixed Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
evaluatable-bounds.rs Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
evaluatable-bounds.stderr Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
evaluatable-bounds.unconstrained.stderr Provide structured suggestion for unconstrained generic constant 2024-03-21 00:03:59 +00:00
feature-gate-generic_const_items.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
feature-gate-generic_const_items.stderr Bless tests 2024-01-13 12:46:58 -05:00
hkl_where_bounds.rs Avoid computing generic params or a param env for free const items 2024-03-19 17:30:08 +00:00
inference-failure.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
inference-failure.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
misplaced-where-clause.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
misplaced-where-clause.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
misplaced-where-clause.stderr Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
parameter-defaults.rs Avoid silencing relevant follow-up errors 2024-01-09 21:08:16 +00:00
parameter-defaults.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
recursive.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
reference-outlives-referent.rs Don't crash when reporting nice region errors for generic const items 2023-08-12 15:34:28 +02:00
reference-outlives-referent.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
trivially-unsatisfied-bounds-0.rs Always evaluate free constants and statics, even if previous errors occurred 2024-02-19 22:11:13 +00:00
trivially-unsatisfied-bounds-0.stderr Always evaluate free constants and statics, even if previous errors occurred 2024-02-19 22:11:13 +00:00
trivially-unsatisfied-bounds-1.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
trivially-unsatisfied-bounds-1.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
unsatisfied-bounds.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
unsatisfied-bounds.stderr Point out the actual mismatch error 2023-10-02 23:14:29 +00:00
unsatisfied-evaluatable-bounds.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
unsatisfied-evaluatable-bounds.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
unsatisfied-outlives-bounds.rs Add UI tests for generic const items 2023-07-28 22:23:20 +02:00
unsatisfied-outlives-bounds.stderr Add UI tests for generic const items 2023-07-28 22:23:20 +02:00