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

Fix compile errors in examples and docs in valuable crate #95

Conversation

alexanderkjall
Copy link

How to reproduce the errors:

$ git clone https://github.com/tokio-rs/valuable.git
Cloning into 'valuable'...
remote: Enumerating objects: 1365, done.
remote: Counting objects: 100% (406/406), done.
remote: Compressing objects: 100% (145/145), done.
remote: Total 1365 (delta 339), reused 262 (delta 259), pack-reused 959
Receiving objects: 100% (1365/1365), 295.04 KiB | 715.00 KiB/s, done.
Resolving deltas: 100% (834/834), done.
$ cd valuable/valuable
$ cargo test

Example error:

error: cannot find derive macro `Valuable` in this scope
 --> valuable/examples/derive.rs:7:10
  |
7 | #[derive(Valuable)]
  |          ^^^^^^^^
  |
note: `Valuable` is imported here, but it is only a trait, without a derive macro
 --> valuable/examples/derive.rs:1:5
  |
1 | use valuable::Valuable;
  |     ^^^^^^^^^^^^^^^^^^

Those are due to that the feature valuable-derive might not have been enabled, and are fixed by adding a #[cfg(not(feature = "valuable-derive",))] around them.

Those are due to that the feature valuable-derive might not have been enabled, and are fixed by adding a #[cfg(not(feature = "valuable-derive",))] around them
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

valuable/examples/derive.rs Outdated Show resolved Hide resolved
@@ -25,6 +25,9 @@ use core::fmt;
/// [`visit_named_fields()`]: Visit::visit_named_fields
/// [`visit_unnamed_fields()`]: Visit::visit_unnamed_fields
///
#[cfg_attr(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fine that documentation or tests require all features. See rust-lang/futures-rs#2216 for more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The background of this patch was that the Debian build system does build crates with the different features both enabled and not enabled, so in order to avoid errors there i wrote this patch: https://salsa.debian.org/rust-team/debcargo-conf/-/blob/master/src/valuable/debian/patches/fix-example-and-doc-compile-errors.patch

And I thought that I should also provide it upstream to be a good community member :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to follow up, does this mean that you are not interested in this PR? That isn't a big problem for me, we can just close it if it won't get merged.

@alexanderkjall
Copy link
Author

Realized that this was neither a complete fix nor a good enough one, closing it for now.

@alexanderkjall alexanderkjall deleted the fix-example-and-doc-compile-errors branch August 27, 2022 16:30
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

Successfully merging this pull request may close these issues.

2 participants