corrosion: Rust editor doesn't show errors

I have the following rust code in the editor:

fn main() {
    let a = "Foo";
    println!("Hello, world!" + a);
}

However, trying to run this from the IDE I do get:

   Compiling new_rust_project v0.1.0 (/home/jreimann/Development/workspace-rust/new_rust_project)
error: format argument must be a string literal
 --> src/main.rs:3:14
  |
3 |     println!("Hello, world!" + a);
  |              ^^^^^^^^^^^^^^^^^^^
help: you might be missing a string literal to format with
  |
3 |     println!("{}", "Hello, world!" + a);
  |              ^^^^^

error: aborting due to previous error

error: Could not compile `new_rust_project`.

To learn more, run the command again with --verbose.

Also see:

image

My expectations would be:

  • The editor shows the same errors, at least when I save the file, or after it got compiled
  • Locations (file + line number) in the log output can be clicked in, to open the file in the IDE
  • I see some error markers in the project explorer

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 42 (22 by maintainers)

Most upvoted comments

@ctron Does this still happen with the 2019-06 RC2 candidate?

I just tested this with 2019-06 RC1 and it works now! Thanks!

Version: 2019-06 RC1 (4.12.0RC1)
Build id: 20190606-1049

Now I can see my code is full of issues 😁

I was having this same problem. The RLS didn’t seem to be working, but it worked when I would start it from the terminal. However, after looking at this comment, I ran cargo clean on each of the projects. After that, I started Eclipse from the UI Desktop and when it started up, the RLS worked as usual.

Try running cargo clean on all of your projects.

Yes.

I have noticed a strange behavior When lunched from CLI as @norru suggested:

RUST_LOG=rls=debug /path/to/your/eclipse &

RLS does not fail, builds everything successfully and starts indexing.

...
org.eclipse.corrosion.rls to LSP4E:{"jsonrpc":"2.0","method":"window/progress","params":{"done":true,"id":"progress_1","title":"Building"}}
org.eclipse.corrosion.rls to LSP4E:{"jsonrpc":"2.0","method":"window/progress","params":{"id":"progress_0","title":"Indexing"}}

But then I close Eclipse, and run it through macos launchpad it fails again on “failed to compile dependent crate”.

My best guess is that there are some environment variable differences, or something that causes difference in behavior.

Ok … now I got something.

The RUST_LOG variable didn’t trigger any logs. But … it did start eclipse from the command line for doing that, instead of starting it from the file manager.

Et voilà … now I got the error in the editor. Re-starting again from the file manager, and I do run into the same issue again. So I definitely can re-produce this now.

Unfortunately the error highlighting works, the IDE stalls with a “timeout” exception towards the language server and fails to “index”. But that is another issue for another day.