Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The correct way of adding the crate frunk dependency #218

Closed
dima-starosud opened this issue Jun 27, 2023 · 8 comments
Closed

The correct way of adding the crate frunk dependency #218

dima-starosud opened this issue Jun 27, 2023 · 8 comments
Assignees

Comments

@dima-starosud
Copy link
Contributor

Most likely the issue is related to possibly outdated documentation.

Using rustc 1.70.0 (90c541806 2023-05-31) and following the latest docs here https://docs.rs/frunk/latest/frunk/
I've added frunk = "0.4.2" to the Cargo.toml, but the following code fails to compile:

use frunk::prelude::*;
use frunk::LabelledGeneric;

#[derive(LabelledGeneric)]
struct Zho {}

with the error:

error[E0433]: failed to resolve: could not find `frunk_core` in the list of imported crates
 --> src/main.rs:4:10
  |
4 | #[derive(LabelledGeneric)]
  |          ^^^^^^^^^^^^^^^ could not find `frunk_core` in the list of imported crates
  |
  = note: this error originates in the derive macro `LabelledGeneric` (in Nightly builds, run with -Z macro-backtrace for more info)

Adding frunk_core = "0.4.2" to the Cargo.toml fixes the issue, but I am not sure that's the proper way. Also, I couldn't find anything in the documentation about this.

To me it looks like sole frunk = "0.4.2" should work out of the box.

@lloydmeta
Copy link
Owner

I think you'll need to pull in frunk_core, unfortunately in order for the derive to work, since it's referenced in the macro that builds the derives.

impl #impl_generics ::frunk_core::labelled::LabelledGeneric for #name #ty_generics #where_clause {

@dima-starosud
Copy link
Contributor Author

Thank you for the response 👍
Do you think we should put this in the doc? i.e. deriving Generic/LabelledGeneric is probably the first prerequisite to use the lib, and to do that one should always pull frunk_core, but docs don't say anything about this.

@lloydmeta
Copy link
Owner

Thank you for the response 👍 Do you think we should put this in the doc? i.e. deriving Generic/LabelledGeneric is probably the first prerequisite to use the lib, and to do that one should always pull frunk_core, but docs don't say anything about this.

That sounds good to me !

@dima-starosud
Copy link
Contributor Author

Cool 👍 Should I create a PR for this?

@lloydmeta
Copy link
Owner

lloydmeta commented Jul 3, 2023 via email

@dima-starosud
Copy link
Contributor Author

I am not sure I am able to assign this ticket to me 🤔

@dima-starosud
Copy link
Contributor Author

dima-starosud commented Jul 4, 2023

@lloydmeta created PR for this #219
Please have a look.

@dima-starosud
Copy link
Contributor Author

Thank you! That was fast 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants