-
Notifications
You must be signed in to change notification settings - Fork 13k
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
#[track_caller]
erroneously points to macro call
#95152
Comments
Not sure if this behavior is intended. @eddyb Do you have something to say about it? You reviewed most of the |
That it is - it's modeled after what you might get from Nowadays, I'm not sure how much we could improve this without somehow encoding all the levels of macro expansion in |
Thank you very much for the information, @eddyb This issue is of my interest so please let me know if there is anything I can help |
I'm not sure it should, but that might be because I think of macros as a copy/paste of code before any function calls occur.
It's been a while since I've been in this code, but do we? I'm only seeing any related attributes on the internal functions, and I'm almost positive there's no compiler knowledge of the |
Would you guys be open to support #[track_caller]
macro_rules! foo { ... } Or macro_rules! foo { ... }
fn main () {
#[track_caller]
foo!( ... )
} |
What I mean is that those functions receive not the location inside That is, @c410-f3r Are you also suggesting changing the default behavior (to not skip macros)? Because without a change, |
Honestly and personally, I am willing to accept anything that tracks function calls inside macros. It is a "breaking change" to modify the current behavior, right? Even though But if it is OK to skip macro calls by default, then OK :) Whatever solution is chosen (if chosen), I can try to implement it myself so that you guys won't have more stuff do to. Just need an overview of how things should be done. |
Kind bump |
Closing due to the lack of response. If you guys want me to deal with this situation with at least a brief mentorship, then feel free to ping me. |
Sorry, didn't see this - I think this would need to be discussed in a larger context, but maybe RFC is overkill? I genuinely don't know the appropriate venue for something like this (as I'm not that active myself). Maybe someone from @rust-lang/lang can nominate this for further discussion?
|
@eddyb Thanks for the explanation |
Nominating this as nobody has reacted to the ping in #95152 (comment), whoops! |
We discussed this in today's @rust-lang/lang meeting. We felt that it does make sense to be able to control whether a macro or its caller is considered the call-site for file/line macros and location information, but that changing the default would be too disruptive: everyone who likes the current behavior would have to change their code to add |
Removing nomination. Next step seems to be somebody trying to make an implementation or at least a concrete proposal for lang review. |
@eddyb I am not familiar with the compiler internals regarding this specific topic so can you provide mentoring? If not, can you suggest someone else? |
Closing due to the lack of activity/feedback. |
Error::line
points to line 38 (let _ = foo!();
) but should in fact point to line 32 (let rslt: u8 = (-1i8).try_into()?;
).The text was updated successfully, but these errors were encountered: