WIP: Make too-many-arguments errors span fn header only#2599
Conversation
The HIR API has no span for just the function header. This commit handles that by using the entire function span until the start of the body expression. This isn't perfect because it includes spaces after the header. Closes #2488
Author
|
I need feedback on this. Is this PR worth merging as is? How can I remove the trailing space from the span? |
Contributor
|
I think we should delay fixing this until rust-lang/rust#49154 has been merged. This should allow us to only point to the name of the function.
You'd need to fetch the text snippet, count the trailing whitespace and shorten the span by that count. But I'm fairly confident that the "all idents have spans" PR will get merged in the next few weeks, so we could hold off until then. Your PR can then be adjusted to make use of the idents. On the other hand we could just merge the PR now and do that fix later. What do you think? |
Author
|
Let's wait. I will close this and submit a new PR later. |
This pull request was closed.
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.
The HIR API has no span for just the function header. This commit handles that
by using the entire function span until the start of the body expression. This
isn't perfect because it includes spaces after the header.
Closes #2488