vamolessa / pepper

simple and opinionated modal code editor for your terminal
https://vamolessa.github.io/pepper/
369 stars 15 forks source link

Bug while installing/compiling with `cargo` #51

Closed NNBnh closed 2 years ago

NNBnh commented 2 years ago

Here are the logs:

❯ cargo install pepper-plugin-lsp
    Updating crates.io index
  Downloaded pepper-plugin-lsp v0.13.0
  Downloaded 1 crate (36.1 KB) in 1.08s
  Installing pepper-plugin-lsp v0.13.0
  Downloaded pepper v0.26.1
  Downloaded libc v0.2.124
  Downloaded 2 crates (717.4 KB) in 2.07s
   Compiling libc v0.2.124
   Compiling pepper v0.26.1
error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 4]`
   --> /home/nnb/.cargo/registry/src/github.com-1ecc6299db9ec823/pepper-0.26.1/src/command.rs:180:48
    |
180 |             self.0 = self.0.trim_start_matches(&[' ', '\t', '\n', '\r']);
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 4]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 4]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 4]`
    = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `&[char; 4]`

error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 2]`
   --> /home/nnb/.cargo/registry/src/github.com-1ecc6299db9ec823/pepper-0.26.1/src/command.rs:272:44
    |
272 |         self.0 = self.0.trim_start_matches(&[' ', '\t']);
    |                                            ^^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 2]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 2]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 2]`
    = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `&[char; 2]`

error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 9]`
   --> /home/nnb/.cargo/registry/src/github.com-1ecc6299db9ec823/pepper-0.26.1/src/command.rs:217:26
    |
217 |             match s.find(&[' ', '\t', '\n', '\r', '"', '\'', '{', '}', '#']) {
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 9]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 9]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 9]`
    = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `&[char; 9]`

For more information about this error, try `rustc --explain E0277`.
error: failed to compile `pepper-plugin-lsp v0.13.0`, intermediate artifacts can be found at `/tmp/cargo-installJcnE6N`

Caused by:
  could not compile `pepper` due to 3 previous errors
❯ cargo install pepper
    Updating crates.io index
  Installing pepper v0.26.1
   Compiling libc v0.2.124
   Compiling pepper v0.26.1
error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 4]`
   --> /home/nnb/.cargo/registry/src/github.com-1ecc6299db9ec823/pepper-0.26.1/src/command.rs:180:48
    |
180 |             self.0 = self.0.trim_start_matches(&[' ', '\t', '\n', '\r']);
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 4]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 4]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 4]`
    = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `&[char; 4]`

error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 2]`
   --> /home/nnb/.cargo/registry/src/github.com-1ecc6299db9ec823/pepper-0.26.1/src/command.rs:272:44
    |
272 |         self.0 = self.0.trim_start_matches(&[' ', '\t']);
    |                                            ^^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 2]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 2]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 2]`
    = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `&[char; 2]`

error[E0277]: expected a `Fn<(char,)>` closure, found `[char; 9]`
   --> /home/nnb/.cargo/registry/src/github.com-1ecc6299db9ec823/pepper-0.26.1/src/command.rs:217:26
    |
217 |             match s.find(&[' ', '\t', '\n', '\r', '"', '\'', '{', '}', '#']) {
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<(char,)>` closure, found `[char; 9]`
    |
    = help: the trait `Fn<(char,)>` is not implemented for `[char; 9]`
    = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&[char; 9]`
    = note: required because of the requirements on the impl of `std::str::pattern::Pattern<'_>` for `&[char; 9]`

For more information about this error, try `rustc --explain E0277`.
error: failed to compile `pepper v0.26.1`, intermediate artifacts can be found at `/tmp/cargo-installq78vuM`

Caused by:
  could not compile `pepper` due to 3 previous errors

I'm running NixOS 21.11

vamolessa commented 2 years ago

In which rustc version does that happen?

NNBnh commented 2 years ago
❯ rustc -V
rustc 1.56.1

❯ cargo -V
cargo 1.56.0
vamolessa commented 2 years ago

I'm think that such version is too old for pepper. Is it possible for you to upgrade it? I know that it works at least with 1.58.0.

Otherwise, you could try changing those lines that take an array ref to a slice by adding a [..] at the end of the array expression. Like for example: self.0 = self.0.trim_start_matches(&[' ', '\t']); becomes self.0 = self.0.trim_start_matches(&[' ', '\t'][..]);

NNBnh commented 2 years ago
❯ rustc -V
rustc 1.58.1
 ~
❯ cargo -V
cargo 1.58.0

Okay this seem to be fixed, thanks!