vscode-lldb doesn't evaluate rust expressions

Viewed 616

When debugging my code in vscode I noticed that it can't seem to find any functions I call. I tried adding to main.rs:

pub fn factorial(n: usize) -> usize {
    if n == 0 {
        1
    } else {
        n * factorial(n - 1)
    }
}

then I set a breakpoint at the start of the program and typed in the Debug Console

p factorial(5)

but I just get

error: could not find item.

If I write

p crate::factorial(5)

I get error: could not find decl "factorial"

What's the correct way to do it? I can't find any examples anywhere.

0 Answers
Related