rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 176 forks source link

Compiling/Installing error: No such file or directory, treesit #520

Closed KDr2 closed 4 months ago

KDr2 commented 4 months ago

I got an error while installing rust-mode:

$HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-mode-treesitter.el at Tue Feb 27 21:04:29 2024
rust-mode-treesitter.el:9:1:Error: Cannot open load file: No such file or directory, treesit

it's caused by this line: https://github.com/rust-lang/rust-mode/blob/master/rust-mode-treesitter.el#L9.

The problem doesn't exist in Emacs 29.1.

Does anyone know how to fix this? Thank you.

psibi commented 4 months ago

How does your rust-mode configuration look like ?

psibi commented 4 months ago

Although the error is surprising since that code should not get evaluated for older emacs: https://github.com/rust-lang/rust-mode/blob/35e68c30fc882dd03c562346fa81eed6c7e09a2f/rust-mode.el#L75

KDr2 commented 4 months ago

I started emacs with emacs -q and ran the code below manually:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
(package-install 'rust-mode)

Then the error occurred.

KDr2 commented 4 months ago

The complete log is like this:

Leaving directory ‘$HOME/.emacs.d/elpa/rust-mode-20240225.526’
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-cargo.el at Tue Feb 27 21:04:29 2024
Entering directory ‘$HOME/.emacs.d/elpa/rust-mode-20240225.526/’
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-common.el at Tue Feb 27 21:04:29 2024
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-compile.el at Tue Feb 27 21:04:29 2024
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-mode-treesitter.el at Tue Feb 27 21:04:29 2024
rust-mode-treesitter.el:9:1:Error: Cannot open load file: No such file or directory, treesit
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-mode.el at Tue Feb 27 21:04:29 2024
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-playpen.el at Tue Feb 27 21:04:29 2024
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-prog-mode.el at Tue Feb 27 21:04:29 2024
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-rustfmt.el at Tue Feb 27 21:04:29 2024
^L
Compiling file $HOME/.emacs.d/elpa/rust-mode-20240225.526/rust-utils.el at Tue Feb 27 21:04:29 2024

Seems it was compiling but not loading?

psibi commented 4 months ago

@KDr2 Thanks, that's helpful. Can you test drive this PR to see if it fixes for you: https://github.com/rust-lang/rust-mode/pull/521 ?

KDr2 commented 4 months ago

@psibi It works! Thank you for the quick response. :heart:

KDr2 commented 4 months ago

But I am still curious why the CI didn't find this.

psibi commented 4 months ago

But I am still curious why the CI didn't find this.

Not sure. Probably the ERT mechanism that we use for testing is not good enough ? I would be happy to accept PR's that improve this.

Closing this issue since it has been fixed by https://github.com/rust-lang/rust-mode/pull/521