Skip to content

debuginfo: Variables in generic functions should have generic type. #8641

Closed
@michaelwoerister

Description

@michaelwoerister

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 type T=int instead of just type int:

fn generic_fun<T>(x: T) -> T {
    ...
}

fn main() {
    let s_have = Some(generic_fun(11111));
}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions