coc-rust-analyzer doesn't display "related information" diagnostics ("value moved here" etc)
See original GitHub issuecoc-rust-analyzer
doesn’t display the “related information” part of diagnostic messages, even though it is reported by the rust-analyzer
language server:
Example program: (playground)
fn main() {
let x = "hello world!\n".to_string();
// - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
// (this diagnostic is missing)
take(x);
// - value moved here
// (this diagnostic is missing)
println!("{}", x);
// ^ value borrowed here after move
// (this diagnostic is displayed)
}
fn take(s: String) {
println!("{}", s);
}
Diagnostic information from trace:
[Trace - 18:21:52] Received notification 'textDocument/publishDiagnostics'.
Params: {
"diagnostics": [
{
"code": "E0382",
"message": "borrow of moved value: `x`\nvalue borrowed here after move",
"range": {
"end": {
"character": 20,
"line": 5
},
"start": {
"character": 19,
"line": 5
}
},
"relatedInformation": [
{
"location": {
"range": {
"end": {
"character": 10,
"line": 3
},
"start": {
"character": 9,
"line": 3
}
},
"uri": "file:///home/yrlf/Programming/rs/misc/foo/src/main.rs"
},
"message": "value moved here"
},
{
"location": {
"range": {
"end": {
"character": 9,
"line": 1
},
"start": {
"character": 8,
"line": 1
}
},
"uri": "file:///home/yrlf/Programming/rs/misc/foo/src/main.rs"
},
"message": "move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait"
}
],
"severity": 1,
"source": "rustc"
}
],
"uri": "file:///home/yrlf/Programming/rs/misc/foo/src/main.rs"
}
Current display in CoC with coc-rust-analyzer
:
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
What do I have to do to solve a "use of moved value" error?
If it doesn't, then the value is moved to the given function, and the caller cannot use it afterwards. That is the meaning...
Read more >User Manual - rust-analyzer
At its core, rust-analyzer is a library for semantic analysis of Rust code as it changes over time. This manual focuses on a...
Read more >src/tools/rust-analyzer/docs/user/manual.adoc - Fossies
At its core, rust-analyzer is a library for semantic analysis of Rust code as it changes over time. This manual focuses on a...
Read more >Untitled
r\nYou can move to the selected line from the displayed list. ... of the plugin for further information on how to use and...
Read more >What do you use for writing rust code? - Reddit
171 votes, 258 comments. Additional information like plugins would be useful. I can only add six options to the poll and presenter what...
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 FreeTop 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
Top GitHub Comments
diagnostic.separateRelatedInformationAsDiagnostics
has added into coc.nvim.Agreed, showing related informations will do grep help for user. We should not be limited to how VSCode does.