-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly record metavar spans for other expansions other than TT #134478
Conversation
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
This comment has been minimized.
This comment has been minimized.
5e166ee
to
4cc9acd
Compare
4cc9acd
to
6d29557
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Properly record metavar spans for other expansions other than TT This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result. Fixes rust-lang#132908 Alternative to rust-lang#133270 cc `@ehuss` cc `@petrochenkov`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (2409fbb): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 4.8%, secondary 3.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary 3.2%, secondary 0.3%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 769.824s -> 771.972s (0.28%) |
unsurprisingly it wrecks incr comp |
Testing to see how much of it is due to the span hashing and how much is due to just recording the spans. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Properly record metavar spans for other expansions other than TT This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result. Fixes rust-lang#132908 Alternative to rust-lang#133270 cc `@ehuss` cc `@petrochenkov`
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8764676): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (secondary 4.4%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -4.2%, secondary 5.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 760.428s -> 761.338s (0.12%) |
I think the regressions are justified by this fix. I think we've actually ended up suppressing a lot of diagnostics in macros because of this not working, and it's evidently very useful for edition migrations too. |
@rustbot ready |
r? @oli-obk |
On the edition call, we discussed this one. This fixes something that we saw repeatedly when analyzing the crater runs for the edition. What happens isn't good; it produces something useless and breaks the migration. So getting this landed, if possible, would be good for supporting the upcoming edition in that way. How might we feel about a backport here? Does it seem safe, or no? |
@bors r+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some thoughts, and something for me to investigate.
|
||
/// Freeze the set, and return the spans which have been read. | ||
/// | ||
/// After this is frozen, no spans that have not been read can be read. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// After this is frozen, no spans that have not been read can be read. | |
/// After this is frozen, only spans that have already been read can be read. |
/// | ||
/// After this is frozen, no spans that have not been read can be read. | ||
pub fn freeze_and_get_read_spans(&self) -> UnordMap<Span, Span> { | ||
self.0.freeze().items().filter(|(_, (_, b))| *b).map(|(s1, (s2, _))| (*s1, *s2)).collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever use this twice? if not, could also poison the lock after extracting the spans we care about.
insert(mspans, dspan.open, metavar_span) | ||
&& insert(mspans, dspan.close, metavar_span) | ||
&& insert(mspans, dspan.entire(), metavar_span) | ||
mspans.insert(dspan.open, metavar_span) | ||
&& mspans.insert(dspan.close, metavar_span) | ||
&& mspans.insert(dspan.entire(), metavar_span) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orthogonal to this PR, but It's not clear to me that it's good keeping the previously inserted spans in the map if one of the later ones in this chain fails.
@bors p=5 (rollup scheduling) |
☀️ Test successful - checks-actions |
Finished benchmarking commit (dee7d0e): comparison URL. Overall result: ❌ regressions - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.6%, secondary 5.4%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 5.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 765.273s -> 762.981s (-0.30%) |
This properly records metavar spans for nonterminals other than tokentree. This means that we operations like
span.to(other_span)
work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result.Fixes #132908
Alternative to #133270
cc @ehuss
cc @petrochenkov