druntime
druntime copied to clipboard
fix Issue 22774 - TraceInfo is gathered only once when throwing a Thr…
…owable
Update info
during every throw
Thanks for your pull request and interest in making D better, @mkykadir! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:
- My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
- My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
- I have provided a detailed rationale explaining my changes
- New or modified functions have Ddoc comments (with
Params:
andReturns:
)
Please see CONTRIBUTING.md for more information.
If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.
Bugzilla references
Auto-close | Bugzilla | Severity | Description |
---|---|---|---|
✓ | 22774 | minor | TraceInfo is gathered only once when throwing a Throwable |
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub run digger -- build "master + druntime#3742"
I think the fix for this should be in user code to set t.info = null
if you want a new trace using the same throwable object.
I think the fix for this should be in user code [...]
Why would one want this behavior ?
Unless the red in the CI is unrelated, then this break a whole lot of stuff.
Unless the red in the CI is unrelated, then this break a whole lot of stuff.
Investigating this but generally time-out during fail-compilation tests (randomly); for example stuck at
... fail_compilation/test16116.d -verrors=0 -m64 -fPIC ()
OK, one of the causes that I could find is this, this changeset conflicts with it. Exceptional cases when GC cannot be trusted (i.e. memory exceptions) are single instanced; and TraceInfo should not be constructed; this changeset causes that.
I think the fix for this should be in user code [...]
Why would one want this behavior ?
In C#, there's a difference between throw;
(a rethrow with the same context) and throw e;
(new context): https://stackoverflow.com/questions/730250/is-there-a-difference-between-throw-and-throw-ex
In D:
try { foo(); }
catch (Exception e) { logException(e); throw e; } // keep the existing TraceInfo!