Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
|
is the windows test failure expected here? |
240a374 to
822a5cc
Compare
|
@connortsui20 the windows failure is from #6410, I think its now fixed there |
d6dbda5 to
bbd1974
Compare
6811eb5 to
3d9d2a7
Compare
Signed-off-by: Adam Gutglick <adam@spiraldb.com> Expect everything Signed-off-by: Adam Gutglick <adam@spiraldb.com>
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
3d9d2a7 to
21938ea
Compare
|
This looks good to me. I was always wondering why we do this, but if @robert3005 has a reason then we can reconsider. |
|
as far as I can tell, it never did that. There is an API to force a backtrace capture even |
|
I spent whole day thinking about this. We can remove VortexExpect BUT we cannot allow expect. It's not about force capturing a backtrace is to make sure that you cannot unwrap/expect errors without backtraces. If you would to allow nightly you could implement VortexExpect so it doesn't double capture but without it I don't have a solution. I spent a while playing on rust playground and the thing that's bad is something like https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=560e73d67f42262bbec6fb609f39b517 |
| tests_outside_test_module = "deny" | ||
| # todo = "deny" | ||
| # unimplemented = "deny" | ||
| unwrap_in_result = "deny" |
There was a problem hiding this comment.
This shouldn't sneak by here, it's orthogonal to the pr
There was a problem hiding this comment.
it doesn't allow calling expect in functions that return a result
| equatable_if_let = "deny" | ||
| exit = "deny" | ||
| expect_fun_call = "deny" | ||
| expect_used = "deny" |
There was a problem hiding this comment.
Per my other comment, this should stay
|
the playground link you shared isn't a permalink, so no idea what you're looking at 😅 |
|
also removing |
|
sorry I updated the link |
|
Ok I see what you're saying, if that's a no go - this PR isn't relevant. I don't think there are many use cases of that, but if we don't trust people to use |
|
We have added this after a painful debugging session where the source of the error was obscured because of expect in bad place. FWIW you can implement this properly if you had |
|
Sorry, just to be concrete: the problem is that we don't capture the backtrace at the site where the But VortexExpect enforces this b/c it only allows us to expect on errors that are VortexError-shaped If that's the case, I think there's a bit of a hole, which is that we currently let you I guess in practice, this is generally not a problem b/c our functions always return VortexResult which means the backtrace should be captured immediately, but if we're really concerned about this then we should probably remove the blanket impl of `VortexExpect |
|
Could we remove it for Option unwrapping? There are 487 usages of that (mostly in tests) and I don't think it helps you at all |
|
mappings those to an error just to unwrap it seems really weird to me, and would actually provide a worse backtrace |
|
Basically I’m fine removing vortexexpect but also keeping deny for expect_used. Yes the problem is that you can use expect on an arbitrary error and that will not provide you with a backtrace. |
|
It feels like what we actually want is to prevent propagating non-VortexError errors across function call boundaries? Like, if I do But if I return a Can we accomplish this by adding This would mean that you either propagate VortexError (which has backtrace), or you have some other error type and are immediately unwrapping it at its return site. |
|
I think forbidding |
|
spent 5 minutes trying to do this ^ on #6575, i hit a snag with serde derived impls but otherwise it's not too bad |


Summary
This PR builds on top of #6410.
This PR removes the
VortexExpecttrait, the way its used right now isn't very useful and adds visual noise in multiple places:vortex-error.vortex_expect(or create-specific expect functions) is just more verbose and not a common pattern in the ecosystemVortexErrorwhich are rarely used (and I would argue should never be used), some codepaths get around that by calling.ok()on the original error, which brings us back to the first point here.API Changes
Removes the
VortexExpecttrait and a fewVortexErrorvariants (likeTryFromInt).Testing