rust-lang / rust-lang/rust

DWARF does not emit DW_TAG_label

Open
#140,407 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-debuginfo A-MIR C-enhancement T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

In the following rust code it would be nice if this emitted a DW_TAG_label

fn foo() {
    'rs_label: {
        break 'rs_label;
    }
}

In the equivalent C code,

int main() {
  c_label:
    return 0;
}

This will emit a DW_TAG_label

 <2><55>: Abbrev Number: 3 (DW_TAG_label)
    <56>   DW_AT_name        : (indirect string, offset: 0): c_label
Meta

rustc --version --verbose:

rustc 1.88.0-nightly (cb31a009e 2025-04-27)
rustc 1.86.0 (05f9846f8 2025-03-31)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust reproducer in the issue and inspect its generated DWARF, comparing it with the equivalent C output that contains DW_TAG_label. Trace the compiler's debug-information handling for labeled blocks and verify completion when the Rust label is emitted as DW_TAG_label with its name.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.