reddit / emacs

Rust lsp not working

wwwfff0 · 2022-05-15 08:19
SOLVED!: reinstalled using this tutorial: [https://www.youtube.com/watch?v=xZEgtWfi\_3w](https://www.youtube.com/watch?v=xZEgtWfi_3w)I don't really have much info this is the error: `server rls:14068/starting exited with status exit(check corresponding stderr buffer for details). Do you want to restart it? (y or n)` Also i have gentoo's rust-bin and the rust toolchain installed at the same time could this be the source of the problem? EDIT: Forgot to install rust analyzer It still doesen't work it says: `(Rust Flymake:wait[0 0] Lens LSP[rust-analyzer:27750] WK ElDoc)` okay so i just change to a rustic config: [https://robert.kra.hn/posts/rust-emacs-setup/](https://robert.kra.hn/posts/rust-emacs-setup/) Now i am having a different issue which i've solved on my previous install but i forgot how i did it: `LSP :: rust-analyzer failed to load workspace: Failed to find sysroot for Cargo.toml dile /home/<user>/projects/programming/rust/tui-rs/Cargo.toml. Is rust-src installed?: can't load standard library from sysroot` `/use/lib/rust/1.60.0` `(discovered via 'rustc --print sysroot')` `try installing rust source the same way you installed rustc`
robertkrahn · 2022-05-15 13:27
Did you use rustup to install Rust? That would be recommended and in that case, `rustup component add rust-src` should help. If you installed rustc directly via a package manager, look for a rust-src package and install that. If all else fails, there is the [Rust source](https://forge.rust-lang.org/infra/other-installation-methods.html#source-code) that you can download directly but that is something you really shouldn't need to do manually.
wwwfff0 · 2022-05-15 14:26
error\[E0670\]: \`async fn\` is not permitted in Rust 2015 --> /home/susam/projects/programmer/rust/qff/src/main.rs:10:1 10 | async fn get\_qoute() -> Result<(), Box<dyn std::error::Error>> { | \^\^\^\^\^ to use \`async fn\`, switch to Rust 2018 or later
wwwfff0 · 2022-05-15 15:06
I've already installed rust-src trough rustup.
robertkrahn · 2022-05-15 18:41
Assuming you get this when you save the buffer, it sounds to me that at least part of your setup is still loading rls or an old rustfmt. Remove it and make sure emacs uses a recent version of rust-analyzer, `lsp-rust-server` should evaluate to `'rust-analyzer`. Make sure that you don't have an old version of rustfmt in your PATH, if you want to use it install the recent version with `rustup component add rustfmt` and make sure it is picked up by emacs.