Point arg num mismatch errors back to their definition#38121
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 6, 2016
Merged
Point arg num mismatch errors back to their definition#38121bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
Hmm. Perhaps. I like seeing the full span here because it shows me the arguments inline. |
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit c735d7f has been approved by |
estebank
reviewed
Dec 5, 2016
| expected_count, | ||
| if expected_count == 1 {""} else {"s"})); | ||
| if let Some(def_s) = def_span { | ||
| err.span_label(def_s, &format!("defined here")); |
Contributor
There was a problem hiding this comment.
Would it make sense to keep lines 2543-2549 in the else for cases where the method was defined in a separate crate and we don't have access to the definition span?
Collaborator
bors
added a commit
that referenced
this pull request
Dec 6, 2016
Point arg num mismatch errors back to their definition
This PR updates the arg num errors (like E0061) to point back at the function definition where they were defined.
Before:
```
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
--> E0061.rs:18:7
|
18 | f(0);
| ^
|
= note: the following parameter types were expected:
= note: u16, &str
```
Now:
```
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
--> E0061.rs:18:7
|
11 | fn f(a: u16, b: &str) {}
| ------------------------ defined here
...
18 | f(0);
| ^ expected 2 parameters
```
This is an incremental improvement. We probably want to underline only the function name and also have support for functions defined in crates outside of the current crate.
r? @nikomatsakis
Collaborator
Contributor
Author
|
@estebank - possibly. we could do an additional PR and take a look (since this landed before we could discuss) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the arg num errors (like E0061) to point back at the function definition where they were defined.
Before:
Now:
This is an incremental improvement. We probably want to underline only the function name and also have support for functions defined in crates outside of the current crate.
r? @nikomatsakis