Skip to content

Variable scoping sometimes inconsistent when debugging #112798

Open
@wesleywiser

Description

@wesleywiser
Member

I tried this code:

fn main() {
  let a = 5;
  let b = 6;
  let c = a + b;
  println!("Hello world {c}");
}

I expected to see this happen:
When setting a breakpoint on the line 2, no variables should be in scope. Then stepping forward one line shows just a in scope, etc.

Instead, this happened:
Both a and b were in scope but "unavailable". c was correctly not in scope until the println!().

Meta

rustc --version --verbose:

rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-pc-windows-msvc
release: 1.70.0
LLVM version: 16.0.2

This may be a Windows specific debugging issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wesleywiser

        Issue actions

          Variable scoping sometimes inconsistent when debugging · Issue #112798 · rust-lang/rust