Skip to content

Inline errors not shown for multi-crate project with custom build script #5962

@RalfJung

Description

@RalfJung

I am trying to get vscode to work properly with Miri. The tricky part is that Miri consists of two (independent) crates, but is not a workspace because that wouldn't work with it also being part of the rustc workspace. So (and also for other reasons) I have a ./miri script somewhat similar to ./x.py. I configured vscode to use that script:

    "rust-analyzer.checkOnSave.overrideCommand": [
        "./miri",
        "check",
        "--message-format=json",
    ],

When I run this on the command-line, it works fine -- at least there is lots of JSON and some of it looks like the error message I am expecting. But in vscode, it doesn't show errors for cargo-miri (the crate that is in a subfolder). It does show errors for the "root" crate -- almost as if it would ignore my command?
I am not sure how to debug this. I found a thing called "extension debug log folder" and in there I found this

[ERROR rust_analyzer::main_loop] File with cargo diagnostic not found in VFS: file not found: /home/r/src/rust/miri/bin.rs

but I am not sure if that has any significance. That folder indeed does not exist, there's a cargo-miri subfolder that is missing -- but the JSON is giving the absolute path correctly:

{"reason":"compiler-message","package_id":"cargo-miri 0.1.0 (path+file:///home/r/src/rust/miri/cargo-miri)","target":{"kind":["bin"],"crate_types":["bin"],"name":"cargo-miri","src_path":"/home/r/src/rust/miri/cargo-miri/bin.rs","edition":"2018","doctest":false,"test":false},"message":{"rendered":"For more information about an error, try `rustc --explain E0069`.\n","children":[],"code":null,"level":"failure-note","message":"For more information about an error, try `rustc --explain E0069`.","spans":[]}}

Any idea why vscode does not show inline errors for cargo-miri?

I realize this is a strange setup, but it is no more strange than rustc's x.py so I am trying to figure out why it does not work.^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions