framesurge / perseus

A state-driven web development framework for Rust with full support for server-side rendering and static generation.
https://framesurge.sh/perseus/en-US
MIT License
2.15k stars 89 forks source link

Failed to compile while running `cargo clippy` #251

Closed rieval closed 1 year ago

rieval commented 1 year ago

This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels. The author described their issue as follows:

Failed to compile while running cargo clippy:


Checking perseus v0.4.0-beta.14
error[E0432]: unresolved import `crate::web_log`
--> C:\Users\86131\.cargo\registry\src\github.com-1ecc6299db9ec823\perseus-0.4.0-beta.14\src\lib.rs:157:13
|
157 |     pub use crate::web_log;
|             ^^^^^^^^^^^^^^ no `web_log` in the root
error[E0432]: unresolved imports crate::PerseusNodeType, crate::Request --> C:\Users\86131.cargo\registry\src\github.com-1ecc6299db9ec823\perseus-0.4.0-beta.14\src\lib.rs:160:21 160 pub use crate::{PerseusNodeType, Request}; ^^^^^^^^^^^^^^^ ^^^^^^^ no Request in the root
no PerseusNodeType in the root

error[E0432]: unresolved import crate::utils::PerseusDuration --> C:\Users\86131.cargo\registry\src\github.com-1ecc6299db9ec823\perseus-0.4.0-beta.14\src\template\core\setters.rs:2:5 | 2 | use crate::utils::PerseusDuration; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no PerseusDuration in utils

error[E0432]: unresolved imports decode_time_str::ComputedDuration, decode_time_str::PerseusDuration --> C:\Users\86131.cargo\registry\src\github.com-1ecc6299db9ec823\perseus-0.4.0-beta.14\src\utils\mod.rs:25:27 25 ... decode_time_str::{ComputedDuration, InvalidDuration, PerseusDuration}; /* These have dummy equiva... ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ no PerseusDuration in utils::decode_time_str
no ComputedDuration in utils::decode_time_str
error[E0392]: parameter M is never used --> C:\Users\86131.cargo\registry\src\github.com-1ecc6299db9ec823\perseus-0.4.0-beta.14\src\init.rs:111:36 111 pub struct PerseusAppBase<G: Html, M: MutableStore, T: TranslationsManager> { ^ unused parameter
= help: consider removing `M`, referring to it in a field, or using a marker such as `PhantomData`
error[E0392]: parameter T is never used --> C:\Users\86131.cargo\registry\src\github.com-1ecc6299db9ec823\perseus-0.4.0-beta.14\src\init.rs:111:53 111 pub struct PerseusAppBase<G: Html, M: MutableStore, T: TranslationsManager> { ^ unused parameter
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error[E0392]: parameter G is never used --> C:\Users\86131.cargo\registry\src\github.com-1ecc6299db9ec823\perseus-0.4.0-beta.14\src\reactor\mod.rs:71:20 71 pub struct Reactor { ^ unused parameter

= help: consider removing G, referring to it in a field, or using a marker such as PhantomData

Some errors have detailed explanations: E0392, E0432. For more information about an error, try rustc --explain E0392. error: could not compile perseus due to 7 previous errors



The steps to reproduce this issue are as follows:
* install CLI: `cargo install perseus-cli --version 0.4.0-beta.14`
* create new project: `perseus new my-app`
* clippy: `cargo clippy`

A minimum reproducible example is available at <>.
- Hydration-related: false
- The author is willing to attempt a fix: false 

<details>
<summary>Tribble internal data</summary>

dHJpYmJsZS1yZXBvcnRlZCxDLWJ1Zw==

</details>
arctic-hen7 commented 1 year ago

Add RUSTFLAGS="--cfg=engine" before that command and you should be good. Setting a .cargo/config.toml as described in the new work-in-progress docs should also work.

That said, I'd be willing to create a perseus cargo .. command that lets these sorts of things be done more easily, since you should really run them for --cfg=client as well.

rwdj commented 1 year ago

For anyone just searching the error, this error also happens if you update Perseus without updating the cli.

cargo install perseus-cli --version 0.4.0-beta.16
arctic-hen7 commented 1 year ago

@rwdj oh yes, currently the CLI is undergoing some major updates as well, so it needs to be kept in sync fully with whatever version you're using. Post v0.4.0 going stable however, that shouldn't be so much of a problem anymore.

rieval commented 1 year ago

I updated to beta.17 and followed the docs to create the .cargo/config.toml. Everything seems to be working fine. Hurray for you!

arctic-hen7 commented 1 year ago

@rieval glad to hear! Since adding that file is now strongly recommended and works for this sort of thing, it's probably not worth creating a perseus cargo command (especially since cargo rustc would probably confuse the flags quite a bit).