-
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
debuginfo: Variables in generic functions should have generic type. #8641
Comments
Visiting for triage. It still seems relevant. |
Triage: nothing to add. |
Triage: same as last year. |
As far as I can tell, this is now fixed, or at least equivalent to output from C++ code. Closing, please reopen if that's not the case. Apologies for my potentially terrible C++, I'm not really familiar enough to speak to it. template<class T>
T generic_fun(T a) {
return a;
}
int main() {
int test = 5;
return generic_fun(test);
} c++ gdb:
fn generic_fun<T>(x: T) -> T {
x
}
fn main() {
let s_have = Some(generic_fun(11111));
} rust gdb:
Edit: I double checked, and technically, I don't see this as being fixed-- |
Yes, what we are doing here is not really wrong (otherwise the issue would not have stayed unfixed for so long). |
As per 3.3.7 Function Template Instantiations of the DWARF 4 specification, the template type parameter DIE (debug information entry) should be referenced where it has been used in the source code, as opposed to the DIE for the type that has been substituted for the parameter.
In the context of Rust this would mean that the variable
x
in the following function should be described as having typeT=int
instead of just typeint
:As of PR #8554 generic functions are supported but arguments, return value, locals, etc are described as having their type concrete type instead of "their generic type substituted by their concrete type". That means that debug info loses some information.
This should not pose a big problem to the regular debugging workflow---but I wanted to record somewhere that this issue exists.
The text was updated successfully, but these errors were encountered: