It infers the wrong file path from json error msg
See original GitHub issueWhen I get an error like:
error: server\src\controllers\driver.rs:241: cannot find struct, variant or union type `Location` in this scope
When I click on it, it opens a non-existing file <project_root>\server\server\src\controllers\driver.rs
but it should instead open the right file at <project_root>\server\src\controllers\driver.rs
.
(Btw, this project is in a workspace, of which server
is one crate.)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
How to Fix the Invalid JSON Error in WordPress? - Rank Math
In this article, learn how to fix the invalid JSON error - 'Updating failed. The response is not a valid JSON response.' with...
Read more >How to Fix the Invalid JSON Response Error in WordPress
Learn what's causing the invalid JSON response error on your WordPress site as well as the different ways you can fix it.
Read more >Cannot fetch local json file, file path error (using a live server ...
I run the index.html with a live server plugin for VSCode. However, no matter what I do, it returns me a 404 Not...
Read more >JSON error handling
In cases where a JavaScript Object Notation (JSON) transaction fails, the API Gateway can use a JSON error to convey error information to...
Read more >How to Fix The Invalid JSON Error in WordPress (Beginner's ...
Are you seeing the JSON response is not valid error on your WordPress site? Here's our step by step guide on how to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
rust-lang/cargo#4788 changed it so that all packages are compiled relative to the workspace root instead of the directory where
cargo
is run. This means that all paths and symbols are now relative to the workspace root. I have updatedcargo metadata
(rust-lang/cargo#4938) in order to determine where the workspace root is. I have a PR waiting to merge this into beta which should go through soon. Once that is done, I’ll open a PR for Rust Enhanced to use this.AFAIK, it is not explicitly documented. I have just been reading the rust source code to figure things out. My notes on the format are here. The JSON structures are defined in libsyntax/json.rs, and there are some comments in there. The code that formats compiler messages into ASCII art is in librustc_errors/emitter.rs. There is not an exact 1:1 relationship between the internal Rust data structures and the JSON format, but it is usually close enough. Let me know if you have any specific questions, since I’ve had to look at this a lot.
I’m curious, what was the actual change to the json msg format? Btw, do you know where the json msg format is documented? The reason I’m asking is because I’m writing a “proxy” for cargo/rustc (compiling another lang to Rust) and the proxy also maps error lines back to lines in the original source using source maps. I got it working but I couldn’t find any doc about the format, and no serde structs. Are there any serde structs somewhere? Btw, I ended up with these (sorry, it’s in my pythonic Rust dialect):