rust-lang / rust-lang/rust

Pretty printers for string produce strings of invalid length

Open
#140,958 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-debuggers-lldb C-bug T-compiler WG-debugging
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

fn main() {
    let two = "2".to_string();
    let three = 2;
}

I placed a breakpoint on line 3 (let three = 2;).
I expected to see the pretty printer provide a valid value for two.
Instead, this happened:
Neither Zed, VSCode nor rust-lldb provided any value for it, instead (seemingly) infinite-looping. When I removed Rust pretty printer for Strings, I noticed that the underlying vec has a pretty large length (over u32::MAX). I believe it's not actually infinite looping; the LLDB has a wrong length.

Meta

rustc --version --verbose:

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: aarch64-apple-darwin
release: 1.86.0
LLVM version: 19.1.7

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 by reproducing the provided Rust program with rustc 1.86.0 on the reported target, then inspect the Rust pretty-printer path for String values and the underlying vector length shown by LLDB. Done means the String value is displayed with a valid length instead of causing Zed, VSCode, or rust-lldb to loop.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.