rust/tests/ui/inference
León Orell Valerian Liehr ae88766286
Rollup merge of #123703 - estebank:diag-changes-2, r=Nadrieril
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! {
   |                ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
```

Address #123630 (test missing).
2024-04-11 01:56:26 +02:00
..
auxiliary
need_type_info Remove a has_errors check that only hides errors after unrelated items have errored. 2024-01-31 16:51:42 +00:00
ambiguous_type_parameter.rs
ambiguous_type_parameter.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
array-len-mismatch.rs
array-len-mismatch.stderr
cannot-infer-async.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
cannot-infer-async.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
cannot-infer-closure-circular.rs Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
cannot-infer-closure-circular.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
cannot-infer-closure.rs
cannot-infer-closure.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
cannot-infer-partial-try-return.rs
cannot-infer-partial-try-return.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
char-as-str-multi.rs
char-as-str-multi.stderr
char-as-str-single.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
char-as-str-single.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
char-as-str-single.stderr
deref-suggestion.rs Suggest deref on comparison binop RHS even if type is not Copy 2023-04-19 16:47:11 +00:00
deref-suggestion.stderr Point at correct exprs for assert_eq type mismatch 2023-06-08 16:30:05 +00:00
erase-type-params-in-label.rs
erase-type-params-in-label.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
ice-cannot-relate-region-109178.rs add test for ice "cannot relate region: LUB(ReErased, ReError)" 2024-03-21 22:02:32 +01:00
ice-cannot-relate-region-109178.stderr add test for ice "cannot relate region: LUB(ReErased, ReError)" 2024-03-21 22:02:32 +01:00
ice-ifer-var-leaked-out-of-rollback-122098.rs add test for https://github.com/rust-lang/rust/issues/122098 ICE: index out of bounds, snapshot_vec.rs 2024-03-21 20:57:54 +01:00
ice-ifer-var-leaked-out-of-rollback-122098.stderr add test for https://github.com/rust-lang/rust/issues/122098 ICE: index out of bounds, snapshot_vec.rs 2024-03-21 20:57:54 +01:00
infer-binary-operand-behind-reference.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
inference_unstable_featured.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
inference_unstable_featured.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
inference_unstable_forced.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
inference_unstable_forced.stderr Bless tests 2024-01-13 12:46:58 -05:00
inference_unstable.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
inference_unstable.stderr Provide structured suggestion for #![feature(foo)] 2024-03-18 16:08:58 +00:00
inference-variable-behind-raw-pointer.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
inference-variable-behind-raw-pointer.stderr
issue-3743.rs Move tests 2024-03-03 16:30:48 -03:00
issue-12028.rs Move tests 2024-02-13 18:08:25 -03:00
issue-12028.stderr Move tests 2024-02-13 18:08:25 -03:00
issue-28935.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-36053.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-70082.rs diagnostics: add test case for already-solved issue 2023-04-25 13:07:09 -07:00
issue-70082.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-70703.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-71309.rs
issue-71309.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-71584.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-71584.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-71732.rs
issue-71732.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-72616.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-72616.stderr Tweak output of to_pretty_impl_header involving only anon lifetimes 2023-08-28 17:17:11 +00:00
issue-72690.rs
issue-72690.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
issue-80409.no-compat.stderr Scrape extraneous regions from instantiate_nll_query_response_and_region_obligations 2024-04-08 15:00:26 +00:00
issue-80409.rs Drive-by DUMMY_SP -> Span and fmt changes 2024-02-19 17:04:23 +00:00
issue-80816.rs
issue-80816.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-81522.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-83606.rs Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
issue-83606.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
issue-86094-suggest-add-return-to-coerce-ret-ty.rs Suggest adding return if the type of unused semi return value can coerce to the fn return type 2023-10-15 22:57:03 +08:00
issue-86094-suggest-add-return-to-coerce-ret-ty.stderr Suggest adding return if the type of unused semi return value can coerce to the fn return type 2023-10-15 22:57:03 +08:00
issue-86162-1.rs
issue-86162-1.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-86162-2.rs
issue-86162-2.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-103587.rs
issue-103587.stderr Support bare unit structs in destructuring assignments 2023-12-08 19:55:07 +00:00
issue-104649.rs
issue-104649.stderr Use fn ptr signature instead of {closure@..} in infer error 2024-04-10 00:41:27 +00:00
issue-107090.rs make type_flags(ReError) & HAS_ERROR 2024-03-20 17:29:58 +00:00
issue-107090.stderr make type_flags(ReError) & HAS_ERROR 2024-03-20 17:29:58 +00:00
issue-113354.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-113354.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-113354.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
lub-glb-with-unbound-infer-var.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
multiple-impl-apply.rs Reorder fullfillment errors to keep more interesting ones first 2023-10-04 02:04:14 +00:00
multiple-impl-apply.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
newlambdas-ret-infer2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
newlambdas-ret-infer.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
question-mark-type-infer.rs Reorder fullfillment errors to keep more interesting ones first 2023-10-04 02:04:14 +00:00
question-mark-type-infer.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
range-type-infer.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
simple-infer.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
stmts-as-exp-105431.rs renaming test cases 2024-02-29 08:46:00 +08:00
stmts-as-exp-105431.stderr renaming test cases 2024-02-29 08:46:00 +08:00
str-as-char.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
str-as-char.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
str-as-char.stderr review comment: str -> string in messages 2024-03-17 23:35:18 +00:00
tutorial-suffix-inference-test.rs
tutorial-suffix-inference-test.stderr
type-infer-generalize-ty-var.rs Ignore tests w/ current/next revisions from compare-mode=next-solver 2024-03-10 21:18:41 -04:00