-
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
Allow the task failure message to be caught #3408
Comments
Oh, there is one failure path that doesn't go through |
are there plans for bringing back the any type? exception handling is the only place i can think of where it would be useful. the way sml does this is by having a global disjunctive exception ("extensible") type for which |
There hasn't been any talk about I'd also like to use |
It would also be really nice if fail didn't have to allocate, especially if throwing an extensible exception type. Instead of shoving it through C++'s one-word-sized stack unwinding data, the fail wrapper function in libcore should probably just put it in TLS. |
For lack of an any type, the best thing I can think of is a utility function that just uses a supervised task and a oneshot pipe internally:
Of course the built-in version would be better (more convenient, no memory allocation) and would only require (edit: if i am not mistaken, this is basically callcc.) |
It occurs to me with an |
From the comments it seems like this issue has had an unfortunate bifurcation. There are two issues of interest:
The value passed to I would prefer that the two topics be kept separate, especially since the meta-data on this issue (like "E-Easy") probably only applies if it is focused on (1) alone, and not (2) as well. |
(Let's try to move future discussion of a potential |
Related to #6874 |
I'm attempting to do this, as it would make rustpkg testing a lot easier. |
@catamorphism I'm also looking into enabling this, but I'm still struggling with understanding how to pass the message along in the unwinding system. I have a working implementation of a One thing I'm not sure how to handle is linked task failure, as that would mean sending a Sendable thing to multiple receivers at once. Maybe just have them receive a enum variant Also, I still need to figure out how to adapt the Anyway, just wanted to pass my notes along. |
@Kimundi Ah ok. I'm not trying to be that ambitious -- just trying to make the ~str part of it work. A more general solution would be better, of course! |
When I started writing the rustpkg tests, task failure didn't set the exit code properly. But bblum's work from July fixed that. Hooray! I just didn't know about it till now. So, now rustpkg uses exit codes in a more conventional way, and some of the tests are simpler. The bigger issue will be to make task failure propagate the error message. Right now, rustpkg does most of the work in separate tasks, which means if a task fails, rustpkg can't distinguish between different types of failure (see rust-lang#3408)
…hism,metajack r? @metajack When I started writing the rustpkg tests, task failure didn't set the exit code properly. But bblum's work from July fixed that. Hooray! I just didn't know about it till now. So, now rustpkg uses exit codes in a more conventional way, and some of the tests are simpler. The bigger issue will be to make task failure propagate the error message. Right now, rustpkg does most of the work in separate tasks, which means if a task fails, rustpkg can't distinguish between different types of failure (see #3408)
This is done! |
do not put tracking issue as part of the option's title
I've occasionally wanted this (for example, it would enable better error reporting for ICEs) but haven't gotten around to implementing it. It should be quite easy now though. In
core::rt::fail
stash the value in TLS, then in the task cleanup code, pull it out of TLS and put it into the notification message. Modifytask::try
to return the string.Ideally this will someday be an
~any
type instead of~str
.The text was updated successfully, but these errors were encountered: