result_tracing: error return tracing in core#1
Open
BGR360 wants to merge 3 commits intoconst-trait-specializefrom
Open
result_tracing: error return tracing in core#1BGR360 wants to merge 3 commits intoconst-trait-specializefrom
result_tracing: error return tracing in core#1BGR360 wants to merge 3 commits intoconst-trait-specializefrom
Conversation
Owner
Author
|
Beep boop I am the CI, here are the UI test failures: Test output |
BGR360
commented
Mar 29, 2022
| } | ||
|
|
||
| #[test] | ||
| fn try_operator_calls_trace() { |
Owner
Author
There was a problem hiding this comment.
TODO: add const equivalent of this test
yaahc
reviewed
Mar 29, 2022
Comment on lines
+2111
to
+2113
| // FIXME(bgr360): how to properly add this change that depends on compiler | ||
| // functionality that's not yet in the beta? | ||
| #[cfg(not(bootstrap))] |
There was a problem hiding this comment.
I think you did it right. The release team has a whole process for how they remove cfg(bootstrap) directives
d912178 to
92cb72b
Compare
f380b39 to
fe53cac
Compare
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.
What It Does
This PR enables users of
Resultto be notified of every invocation of the try operator (?) by implementing a newTracetrait on their error type. For anyResult::<T, E>::Err(e)whereE: Trace, invoking the try operator will callTrace::trace()oneand pass in the code location of the?invocation.So the following code example:
Would produce the following output:
How It Does
core::result::TraceFromResidual for Result<T, E>to behave differently whenE: Trace.Why It Does
The primary motivation for this is to enable low-overhead error return tracing, to borrow the term from the Zig language.
A decent argument for why return tracing is desirable over backtraces or other approaches can be found here.
Additional Context
There is a lengthy thread introducing the idea and cataloging its evolution on Zulip: track_caller error crate.
Blockers
FromResidual for Resultis not valid until rustc can properly handle specialized const trait impls.min_specialization.