leptos-struct-table icon indicating copy to clipboard operation
leptos-struct-table copied to clipboard

compile errors on version 0.14.0-beta2

Open FloWi opened this issue 9 months ago • 2 comments

Hi!

I'm encountering compile errors out of the blue with version 0.14.0-beta2. Very possible that I messed up something on my machine.

This happened first on my side project that built fine before. Yesterday I played around in another project (phospor-leptos) to prepare a PR for leptos 0.8. For that I updated my cargo-leptos version. Don't know which one I used before.

But I found an easy way to reproduce.

git clone [email protected]:Synphonyte/leptos-struct-table.git
git co v0.14.0-beta2
cd examples/serverfn_sqlx
cargo leptos watch

Any idea on how to fix this?

➜ cargo leptos watch
  JavaScript config files are no longer required in Tailwind CSS v4. If you still need to use a JS config file, refer to the docs here: https://tailwindcss.com/docs/upgrade-guide#using-a-javascript-config-file.
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s
       Cargo finished cargo build --package=serverfn_sqlx --lib --target-dir=/Users/florian_witteler/programming/rust/leptos-struct-table/examples/serverfn_sqlx/target/front --target=wasm32-unknown-unknown --no-default-features --features=hydrate
       Front generating JS/WASM with wasm-bindgen
    Finished generating JS/WASM for front in 262.907209ms
    Tailwind finished tailwindcss --input input.css --output /Users/florian_witteler/programming/rust/leptos-struct-table/examples/serverfn_sqlx/target/tmp/tailwind.css
   Compiling leptos-struct-table v0.14.0-beta2 (/Users/florian_witteler/programming/rust/leptos-struct-table)
error[E0310]: the parameter type `Err` may not live long enough
  --> /Users/florian_witteler/programming/rust/leptos-struct-table/src/components/table_content.rs:70:1
   |
70 | #[component]
   | ^^^^^^^^^^^^
   | |
   | the parameter type `Err` must be valid for the static lifetime...
   | ...so that the type `Err` will meet its required lifetime bounds
   |
   = note: this error originates in the attribute macro `component` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding an explicit lifetime bound
   |
189|     Err: Debug + 'static,
   |                +++++++++

error[E0310]: the parameter type `ScrollEl` may not live long enough
  --> /Users/florian_witteler/programming/rust/leptos-struct-table/src/components/table_content.rs:70:1
   |
70 | #[component]
   | ^^^^^^^^^^^^
   | |
   | the parameter type `ScrollEl` must be valid for the static lifetime...
   | ...so that the type `ScrollEl` will meet its required lifetime bounds
   |
   = note: this error originates in the attribute macro `component` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding an explicit lifetime bound
   |
191|     ScrollEl: IntoElementMaybeSignal<web_sys::Element, ScrollM> + 'static,
   |                                                                 +++++++++

error[E0310]: the parameter type `ScrollM` may not live long enough
  --> /Users/florian_witteler/programming/rust/leptos-struct-table/src/components/table_content.rs:70:1
   |
70 | #[component]
   | ^^^^^^^^^^^^
   | |
   | the parameter type `ScrollM` must be valid for the static lifetime...
   | ...so that the type `ScrollM` will meet its required lifetime bounds
   |
   = note: this error originates in the attribute macro `component` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding an explicit lifetime bound
   |
192|     ScrollM: ?Sized + 'static,
   |                     +++++++++

error[E0310]: the associated type `<impl leptos::IntoView as leptos::prelude::Render>::State` may not live long enough
  --> /Users/florian_witteler/programming/rust/leptos-struct-table/src/components/table_content.rs:70:1
   |
70 | #[component]
   | ^^^^^^^^^^^^
   | |
   | the associated type `<impl leptos::IntoView as leptos::prelude::Render>::State` must be valid for the static lifetime...
   | ...so that the type `<impl leptos::IntoView as leptos::prelude::Render>::State` will meet its required lifetime bounds
   |
   = help: consider adding an explicit lifetime bound `<impl leptos::IntoView as leptos::prelude::Render>::State: 'static`...
   = note: this error originates in the attribute macro `component` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0310`.
error: could not compile `leptos-struct-table` (lib) due to 4 previous errors
     Serving at http://127.0.0.1:3000
listening on http://127.0.0.1:3000
    Creating ignore list from '.gitignore' file
^C      Leptos ctrl-c received

If I run the example on master, it compiles fine.

FloWi avatar May 09 '25 11:05 FloWi

If I use the unreleased beta3 tag as a dependency in my project, everything works fine again.

leptos-struct-table = { git = "https://github.com/Synphonyte/leptos-struct-table", tag = "v0.14.0-beta3", features = ["chrono"] }

# used these depedencies as well
leptos = { version = "0.7.7" }
leptos_router = { version = "0.7.7" }
leptos_axum = { version = "0.7.7", optional = true }
leptos_meta = { version = "0.7.7" }

I checked the diff between beta2 and beta3 and saw that you added some 'static lifetimes, but have no idea why this is causing problems all of a sudden, since I'm sure everything compiled fine before you released 0.14.0-beta2.

Anyway - that's as far as I got with my analysis.

FloWi avatar May 09 '25 12:05 FloWi

If I use the unreleased beta3 tag as a dependency in my project, everything works fine again.

leptos-struct-table = { git = "https://github.com/Synphonyte/leptos-struct-table", tag = "v0.14.0-beta3", features = ["chrono"] }

used these depedencies as well

leptos = { version = "0.7.7" } leptos_router = { version = "0.7.7" } leptos_axum = { version = "0.7.7", optional = true } leptos_meta = { version = "0.7.7" } I checked the diff between beta2 and beta3 and saw that you added some 'static lifetimes, but have no idea why this is causing problems all of a sudden, since I'm sure everything compiled fine before you released 0.14.0-beta2.

Anyway - that's as far as I got with my analysis.

This does fix the cargo watch problems (in the betav2 it still allowed for cargo leptos build but not watch) but now the data seems to be fetched/displayed twice on betav3 (but it does solve for cargo leptos watch issues and compilation)

excoffierleonard avatar May 14 '25 02:05 excoffierleonard