-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Error in panic #103169
Error in panic #103169
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
364f9fe
to
e12d483
Compare
This comment has been minimized.
This comment has been minimized.
thread 'main' panicked at 'here's my panic error message', $DIR/error-in-panic.rs:49:5 | ||
Source: my source error message | ||
|
||
Caused by: | ||
my source's source error message | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
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.
The format here is intentionally not intended to be the final format, right now it's fairly inconsistent. I'm not really sure exactly how we'd want to format this. My default suggestion would be something like
thread 'main' panicked at 'here's my panic error message', $DIR/error-in-panic.rs:49:5
source: my source error message
caused by:
my source's source error message
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@@ -62,6 +65,12 @@ impl<'a> PanicInfo<'a> { | |||
self.payload = info; | |||
} | |||
|
|||
#[unstable(feature = "error_in_panic", issue = "none")] |
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.
Can you open a tracking issue for this feature? Thanks!
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.
Tracking issue is here: #103820
What's the plan for using this new Since |
details are in the ACP, but yea pretty much, except there are Issues.
The |
This comment has been minimized.
This comment has been minimized.
4a8060f
to
3ee9353
Compare
This comment has been minimized.
This comment has been minimized.
3ee9353
to
4fcc3ba
Compare
This comment has been minimized.
This comment has been minimized.
4fcc3ba
to
2d49e02
Compare
I'll remove @rustbot label -T-compiler |
@apiraino Thank you, removing the compiler tag seems right for the time being. I believe it was there because |
☔ The latest upstream changes (presumably #105997) made this pull request unmergeable. Please resolve the merge conflicts. |
c07fa9c
to
78cff68
Compare
This comment has been minimized.
This comment has been minimized.
I rebased & I believe this is ready again. |
☔ The latest upstream changes (presumably #109507) made this pull request unmergeable. Please resolve the merge conflicts. |
(Bumping this to the top of my review to do list.) |
In that case I'd not call this I'm wondering though in how many cases the message will really contain something useful. I imagine most of the time one would just want to do basically Separately from that, the But we can leave that for later. ^^
Alright, then I'm curious to see the follow-up PRs to turn this feature into something usable that can be experimented with. |
@@ -62,6 +65,12 @@ impl<'a> PanicInfo<'a> { | |||
self.payload = info; | |||
} | |||
|
|||
#[unstable(feature = "error_in_panic", issue = "none")] |
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.
#[unstable(feature = "error_in_panic", issue = "none")] | |
#[unstable(feature = "error_in_panic", issue = "103820")] |
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] | ||
#[cfg_attr(feature = "panic_immediate_abort", inline)] | ||
#[track_caller] | ||
#[unstable(feature = "error_in_panic", issue = "none")] |
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.
This is not part of the public error_in_panic
API that might be stabilized in the future, right? (But just used internally, like the other functions in this module.) In that case:
#[unstable(feature = "error_in_panic", issue = "none")] | |
#[unstable(feature = "core_panic", issue = "none")] |
pub fn source(&self) -> Option<&(dyn Error + 'static)> { | ||
self.source |
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.
pub fn source(&self) -> Option<&(dyn Error + 'static)> { | |
self.source | |
pub fn error(&self) -> Option<&(dyn Error + 'static)> { | |
self.error |
(etc.)
See comment above.
We should make sure this doesn't add unnecessary overhead, especially for no_std (e.g. embedded) programs. This isn't the best benchmark for that, but let's check it anyway: @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 125171c with merge 8627cf0077fee2bcf01e47c82159e1af1695e583... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8627cf0077fee2bcf01e47c82159e1af1695e583): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking 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. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
|
#110799 should make it possible to just return the error from |
@DebugSteven any updates on this? thanks |
I don't think I'm able to address Mara's technical feedback in a way that satisfies all stakeholders. Right now, my primary focus is on family-related health matters, so I apologize for the delay. If anyone else is interested in picking up the work and completing it, they're more than welcome to do so. |
Closing this as the author has stated that they do not have time for it at the moment. Thanks for contributing |
This PR integrates the trait
Error
so that you can propagate error source withpanic
s.CC: @yaahc