Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no library targets found in package current_project #483

Open
Bkeinn opened this issue Dec 30, 2022 · 6 comments
Open

no library targets found in package current_project #483

Bkeinn opened this issue Dec 30, 2022 · 6 comments

Comments

@Bkeinn
Copy link

Bkeinn commented Dec 30, 2022

I am very new to emacs and are trying to set it up for rust development.
When I am in a *.rs file and M-x rust-mode this error pops up:

Suspicious state from syntax checker rust-cargo: Flycheck checker rust-cargo returned 101, but its output contained no errors: error: no library targets found in package `learn_async`

Try installing a more recent version of rust-cargo, and please open a bug report if the issue persists in the latest release.  Thanks!

I updated cargo rust with:
rustup update
and updated all my packages with paradox.
Emacs: Doom
OS: Fedora
config.el:

[...]
(after! rustic
  (setq lsp-rust-server 'rust-analyzer))

(use-package lsp-mode
  :ensure
  :commands lsp
  :custom
  ;; what to use when checking on-save. "check" is default, I prefer clippy
  (lsp-rust-analyzer-cargo-watch-command "clippy")
  (lsp-eldoc-render-all t)
  (lsp-idle-delay 0.6)
  ;; enable / disable the hints as you prefer:
  (lsp-rust-analyzer-server-display-inlay-hints t)
  (lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial")
  (lsp-rust-analyzer-display-chaining-hints t)
  (lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil)
  (lsp-rust-analyzer-display-closure-return-type-hints t)
  (lsp-rust-analyzer-display-parameter-hints nil)
  (lsp-rust-analyzer-display-reborrow-hints nil)
  :config
  (add-hook 'lsp-mode-hook 'lsp-ui-mode))

(use-package lsp-ui
  :ensure
  :commands lsp-ui-mode
  :custom
  (lsp-ui-peek-always-show t)
  (lsp-ui-sideline-show-hover t)
  (lsp-ui-doc-enable nil))

(rustic and lsp mode both don't work either but I am starting with rust-mode, because it told me to open a new issue)

@psibi
Copy link
Member

psibi commented Dec 31, 2022

What is the rust version you are using (rustc --version) ?

Also, what happens if you do cargo build from your project in a terminal ?

@Bkeinn
Copy link
Author

Bkeinn commented Dec 31, 2022

rustc 1.66.0 (69f9c33d7 2022-12-12)
cargo build:

Compiling learn_async v0.1.0 (/home/heimchen/Documents/Programing/Rust/learn_async)
    Finished dev [unoptimized + debuginfo] target(s) in 1.08s

LSP seams to work in vim

@psibi
Copy link
Member

psibi commented Jan 1, 2023

Ah, I see. Looking into this further - this could be a flycheck issue:

Can you see if installing and configuring flycheck-rust would resolve the issue: https://github.com/flycheck/flycheck-rust ?

@Bkeinn
Copy link
Author

Bkeinn commented Jan 1, 2023

Flycheck-rust was already installed. I reinstalled and nothing changed.

@psibi
Copy link
Member

psibi commented Jan 1, 2023

Did you also have this in your init.el:

(with-eval-after-load 'rust-mode
  (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))

If that doesn't work, then I would suggest you to try re-installing all the packages and check again.

If even that doesn't work, probabaly can make your project public so that I can test your project directly (A new sample project works fine for me in both rust-mode as well as rustic) ?

@brotzeit
Copy link
Contributor

brotzeit commented Jan 1, 2023

If you want to use doom-emacs you should stick with the doom approach. rust-mode(only indirectly through rustic) and paradox are not used by doom. I would suggest that you try to get a minimal doom-emacs config working and then start adding additional config options. There are lots of tutorials that help you with it.

Another possibility would be to try emacs without doom-emacs. You can take a look at https://github.com/rksm/emacs-rust-config and try if it works for you. Configs like these(and of course doom) are used by many other people so the chance is good that it should be working for you, if you stick to the defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants