ccgauche / ytermusic

An in terminal youtube music client with focus on privacy, simplicity and performance
Apache License 2.0
374 stars 19 forks source link

Error E0726 at src/tasks/download.rs:41:13 during compilation. #101

Open ellie-hosts opened 1 day ago

ellie-hosts commented 1 day ago

I'm on the latest Pop!_OS 24.04 release and get an error about an expected lifetime parameter on line 41 of src/tasks/download.rs during compilation. The package downloaded from releases runs fine, but manually compiling gives an error. I've installed the dependencies listed, and I'd presume that since the release can be compiled that it may be an issue with my setup, but I'm not sure exactly what that issue would be.

Git cloning, adding the fix suggested by the compiler, and running cargo build gives more errors that I'm not in the mood to try and fix at the moment.

Initial error output is below.

error[E0726]: implicit elided lifetime not allowed here
  --> src/tasks/download.rs:41:13
   |
41 |     video: &Video,
   |             ^^^^^ expected lifetime parameter
   |
help: indicate the anonymous lifetime
   |
41 |     video: &Video<'_>,
   |                  ++++

For more information about this error, try `rustc --explain E0726`.
error: could not compile `ytermusic` (bin "ytermusic") due to 1 previous error
error: failed to compile `ytermusic v0.1.0 (https://github.com/ccgauche/ytermusic#f14ecfcb)`, intermediate artifacts can be found at `/home/ellie/cargo-compile`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Errors after adding <'_> to src/tasks/download.rs:41:13

error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
  --> src/tasks/download.rs:41:13
   |
41 |     video: &Video<'_>,
   |             ^^^^^---- help: remove these generics
   |             |
   |             expected 0 lifetime arguments
   |
note: struct defined here, with 0 lifetime parameters
  --> /home/ellie/.cargo/git/checkouts/rusty_ytdl-b94e6218ea8b0a29/c017540/src/info.rs:34:12
   |
34 | pub struct Video {
   |            ^^^^^

error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
  --> src/tasks/download.rs:40:1
   |
40 | / pub async fn download<P: AsRef<std::path::Path>>(
41 | |     video: &Video<'_>,
42 | |     path: P,
43 | |     sender: Sender<SoundAction>,
44 | | ) -> Result<(), VideoError> {
   | |___________________________^
   |
   = note: lifetimes appearing in an associated or opaque type are not considered constrained
   = note: consider introducing a named lifetime parameter

Some errors have detailed explanations: E0107, E0581.
For more information about an error, try `rustc --explain E0107`.
error: could not compile `ytermusic` (bin "ytermusic") due to 2 previous errors