-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Readd track_caller to Result::from_residual #91752
Conversation
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
If the calls are inlined, it's likely that the unused location information will already be optimized away. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 44756d8 with merge 8c48303ad50f06e7dd1cc5ba110053ede6d55199... |
This comment has been minimized.
This comment has been minimized.
Looks like it might need some UI output review / blessing. |
My big question here is whether it'd result in a de-facto stability guarantee, despite there not de-jure being one per #88302 (comment). For example, without this we could merge the "re-yeet" MIR blocks from multiple |
No matter what I think we've already made the explicit decision that we do not consider |
☀️ Try build successful - checks-actions |
Queued 8c48303ad50f06e7dd1cc5ba110053ede6d55199 with parent 0b42dea, future comparison URL. |
Finished benchmarking commit (8c48303ad50f06e7dd1cc5ba110053ede6d55199): comparison url. Summary: This change led to moderate relevant regressions 😿 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 led 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 |
r? @cuviper |
The only negative perf results are in incremental builds, and even those are not too bad. I think it's acceptable. @bors r+ |
📌 Commit 94307e2 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (df89fd2): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
This is a followup on #87401 in and an attempt to move the issue towards resolution.
As part of the overhaul of the Try trait we removed the ability for errors to grab location information during propagation via
?
with the builtinstd::result::Result
. The previously linked issue has a fair bit of discussion into the reasons for and against the usage of#[track_caller]
on theFromResidual
impl onResult
that I will do my best to summarize.For
try_trait_v2
changed the location of theFrom::from
caller so the stack trace is different. #87401 (comment): Difficulties with using nonstd::result::Result
like typestry_trait_v2
changed the location of theFrom::from
caller so the stack trace is different. #87401 (comment): Inconsistency with functionality provided for recoverable (Result) and non-recoverable errors (panic), where panic provides a location and Result does not, pushing some users towards using panicAgainst
try_trait_v2
, A new design for the?
desugaring (RFC#3058) #84277 (comment): concern that this will bloat callers that never use this dataPersonally, I want to quantify the performance / bloat impact of re-adding this attribute, and fully evaluate the pros and cons before deciding if I need to switch
eyre
to have a customResult
type, which would also mean I needtry_trait_v2
to be stabilized, cc @scottmcm. If the performance impact is minor enough in the general case I think I would prefer that the defaultResult
type has the ability to track location information for consistency withpanic
error reporting, and leave it to applications that need particularly high performance to handle the micro optimizations of introducing their own efficient custom Result type or matching manually.Alternatively, I wonder if the performance penalty on code that doesn't use the location information on
FromResidual
could be mitigated via new optimizations.