Commit a8b7056
committed
Use
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<{[email protected]: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.fn ptr signature instead of {closure@..} in infer error1 parent e78913b commit a8b7056
File tree
29 files changed
+96
-42
lines changed- compiler/rustc_infer
- src
- errors
- infer/error_reporting
- tests/ui
- array-slice-vec
- const-generics
- defaults
- generic_arg_infer
- generic_const_exprs
- generic-const-items
- inference
- issues
- methods
- traits
- type-inference
- unboxed-closures
29 files changed
+96
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
147 | 150 | | |
148 | 151 | | |
149 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| |||
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
| |||
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
86 | 97 | | |
87 | 98 | | |
88 | 99 | | |
| |||
Lines changed: 54 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
153 | 155 | | |
154 | 156 | | |
155 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
156 | 181 | | |
157 | 182 | | |
158 | 183 | | |
| |||
209 | 234 | | |
210 | 235 | | |
211 | 236 | | |
| 237 | + | |
| 238 | + | |
212 | 239 | | |
213 | 240 | | |
214 | 241 | | |
| |||
387 | 414 | | |
388 | 415 | | |
389 | 416 | | |
| 417 | + | |
| 418 | + | |
390 | 419 | | |
391 | 420 | | |
392 | 421 | | |
| |||
396 | 425 | | |
397 | 426 | | |
398 | 427 | | |
| 428 | + | |
| 429 | + | |
399 | 430 | | |
400 | 431 | | |
401 | 432 | | |
| |||
405 | 436 | | |
406 | 437 | | |
407 | 438 | | |
| 439 | + | |
| 440 | + | |
408 | 441 | | |
409 | 442 | | |
410 | 443 | | |
| |||
442 | 475 | | |
443 | 476 | | |
444 | 477 | | |
445 | | - | |
| 478 | + | |
446 | 479 | | |
447 | 480 | | |
448 | 481 | | |
| |||
518 | 551 | | |
519 | 552 | | |
520 | 553 | | |
521 | | - | |
| 554 | + | |
522 | 555 | | |
523 | 556 | | |
524 | 557 | | |
525 | 558 | | |
526 | 559 | | |
527 | 560 | | |
528 | 561 | | |
529 | | - | |
| 562 | + | |
530 | 563 | | |
531 | 564 | | |
532 | 565 | | |
| |||
547 | 580 | | |
548 | 581 | | |
549 | 582 | | |
550 | | - | |
| 583 | + | |
551 | 584 | | |
552 | 585 | | |
553 | 586 | | |
| |||
584 | 617 | | |
585 | 618 | | |
586 | 619 | | |
587 | | - | |
| 620 | + | |
588 | 621 | | |
589 | 622 | | |
590 | 623 | | |
| |||
606 | 639 | | |
607 | 640 | | |
608 | 641 | | |
| 642 | + | |
| 643 | + | |
609 | 644 | | |
610 | 645 | | |
611 | 646 | | |
| |||
615 | 650 | | |
616 | 651 | | |
617 | 652 | | |
| 653 | + | |
| 654 | + | |
618 | 655 | | |
619 | 656 | | |
620 | 657 | | |
| |||
624 | 661 | | |
625 | 662 | | |
626 | 663 | | |
| 664 | + | |
| 665 | + | |
627 | 666 | | |
628 | 667 | | |
629 | 668 | | |
| |||
688 | 727 | | |
689 | 728 | | |
690 | 729 | | |
691 | | - | |
| 730 | + | |
| 731 | + | |
692 | 732 | | |
693 | 733 | | |
694 | 734 | | |
695 | 735 | | |
696 | 736 | | |
697 | | - | |
| 737 | + | |
698 | 738 | | |
699 | | - | |
| 739 | + | |
700 | 740 | | |
701 | | - | |
| 741 | + | |
702 | 742 | | |
703 | 743 | | |
704 | 744 | | |
705 | 745 | | |
706 | | - | |
| 746 | + | |
707 | 747 | | |
708 | 748 | | |
709 | 749 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments