Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate spans that live in std macros to their use sites #35688
Conversation
rust-highfive
assigned
nikomatsakis
Aug 15, 2016
jonathandturner
force-pushed the
jonathandturner:repair_spans_in_std_macros
branch
from
8488b60
to
77e5f3c
Aug 15, 2016
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis - Realizing this will only update the error that is displayed but not the json errors. That will need to be updated before this can be merged. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis actually, scratch that. The same information is available in both the json and the presentation, I'm just using a different presentation of it. Consumers of the json would still be able to recreate this output using the backtrace information. Using eg:
From:
|
jonathandturner
referenced this pull request
Aug 15, 2016
Merged
Replace macro backtraces with labeled local uses #35702
nikomatsakis
reviewed
Aug 16, 2016
| self.emit_messages_default(db); | ||
| let mut primary_span = db.span.clone(); | ||
| let mut children = db.children.clone(); | ||
| self.fix_multispans_in_std_macros(&mut primary_span, &mut children); |
This comment has been minimized.
This comment has been minimized.
nikomatsakis
reviewed
Aug 16, 2016
| let sub_result = self.get_multispan_max_line_num(&sub.span); | ||
| max = if sub_result > max { primary } else { max }; | ||
| } | ||
| max | ||
| } | ||
|
|
||
| fn fix_multispan_in_std_macros(&mut self, span: &mut MultiSpan) -> bool { |
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Aug 16, 2016
Contributor
Nit: This could use a comment explaining what it is aiming to do
nikomatsakis
reviewed
Aug 16, 2016
| let v = cm.macro_backtrace(sp.clone()); | ||
| if let Some(use_site) = v.last() { | ||
| before_after.push((sp.clone(), use_site.call_site.clone())); | ||
| }; |
This comment has been minimized.
This comment has been minimized.
nikomatsakis
reviewed
Aug 16, 2016
| @@ -221,6 +221,25 @@ impl MultiSpan { | |||
| &self.primary_spans | |||
| } | |||
|
|
|||
| /// Replaces all occurances of one Span with another. Used to move Spans in areas that don't | |||
| /// display well (like std macros). Returns true of replacements occurred. | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
r=me with nits addressed |
This comment has been minimized.
This comment has been minimized.
|
Closing this one in lieu of the more complete #35702 |
jonathandturner
closed this
Aug 16, 2016
bors
added a commit
that referenced
this pull request
Aug 18, 2016
jonathandturner
deleted the
jonathandturner:repair_spans_in_std_macros
branch
Aug 18, 2016
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.
jonathandturner commentedAug 15, 2016
•
edited
This PR updates the error reporting to detect when a span used in the error message will be labeling a span in the
<std macros>. If it detects this, it will update it to the use site, if possible.Before:
After:
To help with the messages that may not become confusing because they will be referring to a definition inside of
<std macros>we also add a note to help understand that we're using the use but the definition is in<std macros>Another before:
And after:
r? @nikomatsakis