Skip to content
This repository was archived by the owner on Dec 8, 2020. It is now read-only.
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

backtrace doesn't link to my source code reliably (subprojects) #152

Closed
@radix

Description

@radix

Version of VSCode: 1.10.2
Version of the extension: 0.3.10
OS: Windows 10

Description:

When I run my tests, the stack traces sometimes link to my source code (so that I can ctrl-click a filename in the traceback and have it open the editor to that file/line etc), and sometimes doesn't. This may be related to the fact that I use Cargo workspaces with subprojects.

As an example, if I hit ctrl-shift-t in one of my subproject files, rust-vscode very nicely figures out which subproject to run the tests for. Since I have RUST_BACKTRACE=1 set up in my environment, the output shows the tracebacks for my test failures. Here's an example of a traceback:

---- combat::test::target_range stdout ----
	thread 'combat::test::target_range' panicked at 'called `Result::unwrap()` on an `Err` value: CreatureLacksAbility(CreatureID(Uuid("b972f025-769d-417f-ba02-830a8c9f2a36")), AbilityID("shoot"))', src\libcore\result.rs:860
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: core::result::Result<pandt::game::ChangedGame, pandt::types::GameError>::unwrap<pandt::game::ChangedGame,pandt::types::GameError>
             at C:\projects\rust\src\libcore\result.rs:737
   1: pandt::combat::test::target_range
             at ./src\combat.rs:270
   2: test::{{impl}}::call_box<(),closure>
             at C:\projects\rust\src\libtest\lib.rs:140
   3: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:98
   4: std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure>,()>
             at C:\projects\rust\src\libstd\panicking.rs:450
   5: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:98
   6: alloc::boxed::{{impl}}::call_box<(),closure>
             at C:\projects\rust\src\liballoc\boxed.rs:638
   7: std::sys::imp::thread::{{impl}}::new::thread_start
             at C:\projects\rust\src\libstd\sys\windows\thread.rs:50

Notice in particular the line with the filename ./src\combat.rs:270. I believe the reason this isn't automatically being rendered as a link, is that it's probably looking for the filename from the root of my project instead of from the subproject directory.

I don't know if vscode-rust can actually do anything to solve this. Maybe there's a way to get cargo to always show absolute paths in tracebacks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions