Closed otuk closed 6 years ago
Hmm, it's surprising that you get different behavior in emacs25-nox
and in emacs24. But as for flycheck-rust
not finding cargo
, it's because you are using:
(setq flycheck-rust-cargo-executable "~/.cargo/bin/cargo")
This is a Flycheck variable used to override the checker executable, but flycheck-rust uses flycheck-executable-find
to locate cargo
by looking in your PATH. It's confusing because cargo
is both the checker command and the program we use to configure your project. And also because the prefix flycheck-rust
might makes one think it belong to the flycheck-rust
package but it's actually a flycheck.el
variable.
So I suggest either customizing flycheck-executable-find
in your (use-package flycheck-rust
config, or better yet add ~/.cargo/bin/cargo
to Emacs' PATH.
Thank you @fmdkdd
I made the change for PATH in config.org within the cargo area and kept everything else the same:
;;install cargo minor mode
;; C-c C-c C-b to run cargo build
;; C-c C-c C-r to run cargo run
;; C-c C-c C-t to run cargo test
(use-package cargo
:ensure t
:config
;; change emacs PATH o include cargo/bin
(setenv "PATH" (concat (getenv "PATH") ":~/.cargo/bin"))
(setq exec-path (append exec-path '("~/.cargo/bin")))
)
And I get to see the flycheck results :) Yipee.
But I still cannot do C-c C-c C-b
to do a build directly, I know this is not fly check related, but maybe I get help?
Any such action generates the following error, I did not find any reference to it for cargo related modules in google searches.
cargo-process--workspace-root: Symbol's function definition is void: alist-get
And I get to see the flycheck results :) Yipee.
Yeah!
cargo-process--workspace-root: Symbol's function definition is void: alist-get
This is a cargo-mode
bug: the package claims Emacs 24.3 support, but alist-get
is in Emacs 25+. I see you've reported https://github.com/kwrooijen/cargo.el/issues/67, so I will close this one here.
@fmdkdd, thanks again
I have used rustup to update my stable as well as my nightly toolchain on commandline
which cargo
responds as expected (~/.cargo/bin/cargo), so cargo is on my path.in emacs v24 error messages as soon as I open a rust file I see the following with the STABLE toolchain (rustc version 1.29.2) The editions related issue goes away if I use NIGHTLY toolchain. So that is not a concern.
The real issue is none of the in editor flycheck "checks" are happening. I cannot use the cargo build/run etc shortcuts either
It is very possible there is some stupid mistake in my setup but I could not see it. BTW if I run emacs25-nox with same installation and copy of the rust configuration, things run, but in nox version :(
this is the real error message errors with nightly toolchain, all other config kept same:
my flycheck verification shows the following while I am in the same rust file:
my rust coding related config: