-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Many functions with rustc_inherit_overflow_checks
should also have track_caller
#119682
Comments
Fixed by #119726. |
It doesn't seem like #119726 fixes all such missed There are panicking functions with
Functions for which
Additionally
Possibly all functions that require Example:
With:
Results in:
Expected something like:
Version (last nightly):
|
@dtolnay, could you please review my previous comment. I think that issue is not fixed and should be reopened. |
In general, if a library function panics due to invalid input, its best if the error message point to the function call and explain why the input was invalid. An overflow in a core library function with the
#[rustc_inherit_overflow_checks]
attribute is probably due to invalid input.Assuming a function could only panic due to incorrect input, the only potential drawback to
#[track_caller]
I can see is the panic message not adequately explaining why the input was invalid. Until we get #111466, we can only pass the text of the overflow error. Fordiv_euclid
*, this is perfect. Fornext_multiple_of
, this is sufficient. Foradvance_by
, I'm not sure.Adding the attribute is trivial. I'm only making this issue to ask if/what functions I should add the attribute to and if I need to.
See also: #102024 #114841
* Edit: The division function might be a confusing example since it doesn't care about
#[rustc_inherit_overflow_checks]
. However, it should have#[track_caller]
like the others.The text was updated successfully, but these errors were encountered: