-
Notifications
You must be signed in to change notification settings - Fork 71
Add a compile_error!()
when central crate features clash
#110
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
base: master
Are you sure you want to change the base?
Changes from all commits
06ed053
5115eef
7d29fb9
ab47652
adbc618
cd40d4f
f110a2e
b650660
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
onkoe marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -67,12 +67,25 @@ | |||||
//! | ||||||
//! Have a look at the examples to learn more about device and buffer management. | ||||||
|
||||||
#[cfg(feature = "v4l-sys")] | ||||||
#[cfg(all(feature = "libv4l", feature = "v4l2"))] | ||||||
compile_error!( | ||||||
"You may not enable both `v4l-sys` and `v4l2-sys` features at the same time.\ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You name these
Suggested change
|
||||||
Try disabling one of them. If you only specified one feature, you may wish to\ | ||||||
add `default-features = false` as a dependency key." | ||||||
); | ||||||
|
||||||
#[cfg(all(feature = "libv4l", not(feature = "v4l2")))] | ||||||
pub use v4l_sys; | ||||||
|
||||||
#[cfg(feature = "v4l2-sys")] | ||||||
#[cfg(all(feature = "v4l2", not(feature = "libv4l")))] | ||||||
pub use v4l2_sys as v4l_sys; | ||||||
|
||||||
// calms down rust-analyzer when `rust-analyzer.cargo.features = "all"`, | ||||||
// though the `compile_error!()` above prevents this from being a valid, | ||||||
// compilable configuration. | ||||||
#[cfg(all(feature = "v4l2", feature = "libv4l"))] | ||||||
pub use v4l_sys; | ||||||
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not do what you've done in the second patch (but the other way around):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would also prefer this, but I found that doing so breaks one of the features. On the other hand, it doesn't occur in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would match the choice in Either way, this seems better to me: diff --git a/src/lib.rs b/src/lib.rs
index 2272aeb..1237262 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -74,16 +74,12 @@ compile_error!(
add `default-features = false` as a dependency key."
);
-#[cfg(all(feature = "libv4l", not(feature = "v4l2")))]
-pub use v4l_sys;
-
-#[cfg(all(feature = "v4l2", not(feature = "libv4l")))]
-pub use v4l2_sys as v4l_sys;
-
-// calms down rust-analyzer when `rust-analyzer.cargo.features = "all"`,
-// though the `compile_error!()` above prevents this from being a valid,
+// calm down rust-analyzer when `rust-analyzer.cargo.features = "all"` by having only one `v4l_sys`
+// crate in scope, even though the `compile_error!()` above prevents this from being a valid,
// compilable configuration.
-#[cfg(all(feature = "v4l2", feature = "libv4l"))]
+#[cfg(feature = "v4l2")]
+pub use v4l2_sys as v4l_sys;
+#[cfg(all(feature = "libv4l", not(feature = "v4l2")))]
pub use v4l_sys;
pub mod v4l2; |
||||||
|
||||||
pub mod v4l2; | ||||||
|
||||||
pub mod buffer; | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.