]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser
authorbors <bors@rust-lang.org>
Mon, 11 Oct 2021 04:31:47 +0000 (04:31 +0000)
committerbors <bors@rust-lang.org>
Mon, 11 Oct 2021 04:31:47 +0000 (04:31 +0000)
commit9a757817c352801de8b0593728f8aee21e23cd53
tree42c5d573cee81a5de4b243cbe9d52eddeda23a97
parent1ddd4e6d7ed446934abd428a08e18535faef5e03
parent61c5a6d644e9e5c1995c33a2b07ab251702848ac
Auto merge of #89597 - michaelwoerister:improve-vtable-debuginfo, r=wesleywiser

Create more accurate debuginfo for vtables.

Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented.

This is only one of several possible improvements:
- This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits).
- The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object.

r? `@wesleywiser`
compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
compiler/rustc_codegen_ssa/src/meth.rs