Skip to content

debuginfo: slices are DW_TAG_array_type's#153238

Open
shua wants to merge 1 commit intorust-lang:mainfrom
shua:lldb-rcstr
Open

debuginfo: slices are DW_TAG_array_type's#153238
shua wants to merge 1 commit intorust-lang:mainfrom
shua:lldb-rcstr

Conversation

@shua
Copy link
Copy Markdown

@shua shua commented Mar 1, 2026

Rust debuginfo for unsized structs with embedded slice types is lacking, and it makes it difficult for debuggers to correctly print types like Rc<str> (eg #114195). Specifically, these three structs would have essentially the same debug info (modulo some names):

struct Foo { a: u32, s: str } // unsized
struct Bar { a: u32, s: [u8] } // unsized
struct Baz { a: u32, s: u8 }

This changes how the compiler generates debuginfo in this case, and I used existing compilers (gcc, clang) handling of C flexible member arrays as a reference.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 1, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 1, 2026

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, debuginfo
  • compiler, debuginfo expanded to 69 candidates
  • Random selection from 15 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@shua
Copy link
Copy Markdown
Author

shua commented Mar 1, 2026

another relevant thread from gdb bugtracker about rust's weird unsized type debug info and some related fixes in gdb: https://sourceware.org/bugzilla/show_bug.cgi?id=30330 . The type of change here (changing slice types to be array types with no count, similar to C's VLA/FMA) was discussed but I guess never implemented in rustc?

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Mar 2, 2026

☔ The latest upstream changes (presumably #153304) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Copy Markdown
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a codegen-llvm test for the debuginfo?

View changes since this review

@Enselic Enselic added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants