Commit ae88766
authored
Rollup merge of rust-lang#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 rust-lang#123630 (test missing).File tree
29 files changed
+98
-47
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
+98
-47
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: 56 additions & 19 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 | + | |
| 239 | + | |
| 240 | + | |
212 | 241 | | |
213 | 242 | | |
214 | 243 | | |
| |||
223 | 252 | | |
224 | 253 | | |
225 | 254 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | 255 | | |
232 | 256 | | |
233 | 257 | | |
| |||
387 | 411 | | |
388 | 412 | | |
389 | 413 | | |
| 414 | + | |
| 415 | + | |
390 | 416 | | |
391 | 417 | | |
392 | 418 | | |
| |||
396 | 422 | | |
397 | 423 | | |
398 | 424 | | |
| 425 | + | |
| 426 | + | |
399 | 427 | | |
400 | 428 | | |
401 | 429 | | |
| |||
405 | 433 | | |
406 | 434 | | |
407 | 435 | | |
| 436 | + | |
| 437 | + | |
408 | 438 | | |
409 | 439 | | |
410 | 440 | | |
| |||
442 | 472 | | |
443 | 473 | | |
444 | 474 | | |
445 | | - | |
| 475 | + | |
446 | 476 | | |
447 | 477 | | |
448 | 478 | | |
| |||
518 | 548 | | |
519 | 549 | | |
520 | 550 | | |
521 | | - | |
| 551 | + | |
522 | 552 | | |
523 | 553 | | |
524 | 554 | | |
525 | 555 | | |
526 | 556 | | |
527 | 557 | | |
528 | 558 | | |
529 | | - | |
| 559 | + | |
530 | 560 | | |
531 | 561 | | |
532 | 562 | | |
| |||
547 | 577 | | |
548 | 578 | | |
549 | 579 | | |
550 | | - | |
| 580 | + | |
551 | 581 | | |
552 | 582 | | |
553 | 583 | | |
| |||
584 | 614 | | |
585 | 615 | | |
586 | 616 | | |
587 | | - | |
| 617 | + | |
588 | 618 | | |
589 | 619 | | |
590 | 620 | | |
| |||
606 | 636 | | |
607 | 637 | | |
608 | 638 | | |
| 639 | + | |
| 640 | + | |
609 | 641 | | |
610 | 642 | | |
611 | 643 | | |
| |||
615 | 647 | | |
616 | 648 | | |
617 | 649 | | |
| 650 | + | |
| 651 | + | |
618 | 652 | | |
619 | 653 | | |
620 | 654 | | |
| |||
624 | 658 | | |
625 | 659 | | |
626 | 660 | | |
| 661 | + | |
| 662 | + | |
627 | 663 | | |
628 | 664 | | |
629 | 665 | | |
| |||
688 | 724 | | |
689 | 725 | | |
690 | 726 | | |
691 | | - | |
| 727 | + | |
| 728 | + | |
692 | 729 | | |
693 | 730 | | |
694 | 731 | | |
695 | 732 | | |
696 | 733 | | |
697 | | - | |
| 734 | + | |
698 | 735 | | |
699 | | - | |
| 736 | + | |
700 | 737 | | |
701 | | - | |
| 738 | + | |
702 | 739 | | |
703 | 740 | | |
704 | 741 | | |
705 | 742 | | |
706 | | - | |
| 743 | + | |
707 | 744 | | |
708 | 745 | | |
709 | 746 | | |
| |||
| 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