I'm currently struggling to set up error checking for rust in emacs. Flycheck seems to work fine with other languages (C, Python, Ruby, eLisp) but doesn't appear to do anything in rust-mode.

I haven't noticed any error messages, but when I run flycheck-verify-setup, I get the following:

Syntax checkers for buffer state.rs in rust-mode:

    - predicate:  nil
    - executable: Not found

    - predicate:  nil
    - executable: Not found

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled

I tried manually setting the executable but wasn't sure about the predicate, and was concerned that I'd be interfering with flycheck-rust-setup.

The current configuration code I have written concerning this is:

(setq exec-path (append exec-path '("/Users/jac32/.cargo/bin")))
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))

;; Set path to racer binary 
(setq racer-cmd "/usr/local/bin/racer")

;; Set path to rust src directory
(setq racer-rust-src-path "/Users/jac32/.rust/src/")

(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
(add-hook 'rust-mode-hook
     (lambda ()
         (setq flycheck-mode-hook #'flycheck-rust-setup)))

And my current setup loads all of the following packages:

(defvar required-packages
  ) "a list of packages to ensure are installed at launch.")

Thank you for any and all help on this issue.

update Just discovered that the rustc and cargo executables were not located anywhere within the exec-path variable. Under flycheck-verify-setup, both checker executables are found and the predicate for rust-cargo is t. However, resetting flycheck-mode now causes the following message to appear:

Suspicious state from syntax checker rust-cargo: Checker rust-cargo
returned non-zero exit code 101, but no errors from output: Could not             
execute process `rustc -vV` (never executed)

Caused by:
 No such file or directory (os error 2)
  • Hrm -- as you can probably tell, it's mad about something not existing. But, it's hard to guess what. If you M-x toggle-debug-on-error and try again, do you get a more verbose error? My assumption is that either the file you're trying to lint hasn't been written to disk, or one of the config values is a little off.
    – Gastove
    May 2, 2016 at 20:40
  • I ran the command you suggested, but it didn't seem to change any behaviour and the error output was the same. May 3, 2016 at 0:11
  • Dang. I was hoping you'd at least get a more informative stack trace.
    – Gastove
    May 3, 2016 at 4:21

1 Answer 1


I had very similar problem. I use OSX and both cargo and rustc weren't in exec-path. Because I see you have /Users path - I assume u run emacs on OSX too.

My solution was exec-path-from-shell plugin. I added to my init.el something like this:

(req-package exec-path-from-shell
    (if (eq system-type 'darwin)

And remember to run cargo build.

This article was very helpful when I was looking for a solution.

  • This answer led me to a solution. Installing the exec-path-from-shell plugin and adding the following to my init.el file as detailed in the provided link from @Frondeus worked like a charm: (when (memq window-system '(mac ns))(exec-path-from-shell-initialize))
    – ramsey_tm
    Aug 25, 2016 at 19:29
  • BTW, rustup has problems with adding rust binaries to PATH automatically on MacOS.
    – kolen
    Jan 29, 2018 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.