VSCode : set up rust std lib source code navigation and debugging

How can I navigate inside rust standard library source code when I want to see implementation of some function ?

How to set up debugger to do rust std lib debugging ? Currently it takes me to assembly.

I am on windows.

I use vscode with rust-analyzer, AFAIK you'll only need to have rust-src installed to get the ability to look up implementations of standard library items. I.e. rustup component add rust-src. (I don't have experience with other rust plugins besides rust-analyzer, so I can't help too much in that case, but maybe installing rust-src helps in such cases, too?). I never tried using a debugger yet, but perhaps the same thing helps there, as well?

I had tried rust-src it didn't seem to work that day.
Today it started working.

About debugging, It still takes me to assembly.
I think this could be because of no source mapping between my local installed src dir and what is present in pdb ?

Added

"sourceMap": { "\\rustc\\f1edd0429582dd29cccacaf50fd134b05593bd9c\\" : "<PATH_TO_Rust_Src>\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\" },

in my .vscode\launch.json helped me.
Doc: vscode-lldb/MANUAL.md at master · vadimcn/vscode-lldb · GitHub

Still,
for this code:

let mut current_set = backtrace_maps[0].get(*k).unwrap()
  .intersection(backtrace_maps[1].get(*k).unwrap()).cloned().collect::<HashSet<i64>>();

debugger is not going inside intersection function :frowning: ..

how can i build my debug binary with debug version of std lib ?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.