Skip to content

Pretty printers for string produce strings of invalid length #140958

Open
@osiewicz

Description

@osiewicz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuggers-lldbArea: lldbC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-debuggingWorking group: Bad Rust debugging experiences

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions