I am trying to use lsp-rust package. I installed it from melpa. After I run it I got message in *Messages*:

Error loading autoloads: (void-function lsp-define-stdio-client)

There are two packages: lsp-rust and lsp-mode (both of them I install from melpa),

lsp-define-stdio-client defined in lsp-mode, and was used in lsp-rust, code from lsp-rust.el:

(require 'lsp-mode)
(lsp-define-stdio-client 'rust-mode "rust" 'stdio
            "Rust Language Server"
(provide 'lsp-rust)

If run emacs --debug-init, then problem happens in the first line of .emacs:


I not get it, why autoload of lsp-rust happened before lsp-mode, execution of autoload functions not depend on require and provide?


I can fix this issue, if I edit ~/.emacs.d/elpa/lsp-rust-20170421.326/lsp-rust-autoloads.el, and change

(lsp-define-stdio-client 'rust-mode "rust" 'stdio #'lsp-rust--get-root "Rust Language Server" (lsp-rust--rls-command))


(require 'lsp-mode)
(require 'lsp-rust)
(lsp-define-stdio-client 'rust-mode "rust" 'stdio #'lsp-rust--get-root "Rust Language Server" (lsp-rust--rls-command))

In other words add (require 'lsp-mode) and (require 'lsp-rust) manually, but this is temporary solution, untill M-x list-packages download new version of lsp-rust.

  • @Drew Sorry, not understand your advise. About your file, there is no my file here, all packages installed from melpa with M-x list-packages, and I suppose emacs 25 package manager put stuff into load-path.
    – fghj
    Jul 22, 2017 at 23:47
  • Perhaps someone will have a specific answer for you. The package should take care of defining its autoloads correctly. I was guessing that perhaps it does not.
    – Drew
    Jul 22, 2017 at 23:57
  • @Drew lsp-define-stdio-client is defun.
    – fghj
    Jul 23, 2017 at 0:08
  • @Drew Looks like this is bug in lsp-rust, autoloaded code is cut from main elisp file, so require which import lsp-define-stdio-client is not executed.
    – fghj
    Jul 23, 2017 at 0:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.