Commit 21f8e37
authored
Rollup merge of #160234 - estebank:issue-101242, r=oli-obk
Always use short ty path for call with missing arguments suggestion
Mitigate having too long of a suggestion when there are many arguments missing by not printing the full path of the expected types.
```
error[E0061]: this function takes 5 arguments but 0 arguments were supplied
--> $DIR/verbose-suggestion-for-missing-fn-args.rs:5:5
|
LL | my_very_long_function_name_with_lots_of_args();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- multiple arguments are missing
|
note: function defined here
--> $DIR/verbose-suggestion-for-missing-fn-args.rs:8:4
|
LL | fn my_very_long_function_name_with_lots_of_args(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | _first_long_param: bool,
| -----------------------
LL | _second_long_param: HashMap<Arc<String>, Vec<BTreeSet<usize>>>,
| --------------------------------------------------------------
LL | _third_long_param: usize,
| ------------------------
LL | _fourth_long_param: String,
| --------------------------
LL | _fifth_long_param: Mutex<Option<VecDeque<Arc<String>>>>,
| -------------------------------------------------------
help: provide the arguments
|
LL | my_very_long_function_name_with_lots_of_args(/* bool */, /* HashMap<Arc<String>, Vec<BTreeSet<usize>>> */, /* usize */, /* String */, /* Mutex<Option<VecDeque<Arc<String>>>> */);
| +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
```
Partially address #101242. More work is needed to close that ticket, but this is an easy stop gap.5 files changed
Lines changed: 50 additions & 5 deletions
File tree
- compiler/rustc_hir_typeck/src/fn_ctxt
- tests/ui
- argument-suggestions
- traits/next-solver
- type
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
3489 | 3490 | | |
3490 | 3491 | | |
3491 | 3492 | | |
3492 | | - | |
| 3493 | + | |
3493 | 3494 | | |
3494 | 3495 | | |
3495 | 3496 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments