unexpected behavior inside struct, for feature-gated arguments #55

Open
opened 2022-06-29 14:02:44 -05:00 by thor314 · 0 comments
thor314 commented 2022-06-29 14:02:44 -05:00 (Migrated from github.com)

Attempting the following:

pub(crate) struct Args {
	cfg_if! {
		if #[cfg(feature = "my_feat")] {
			some_feature_gated_arg: u8,
			some_other_feature_gated_arg: u8,
		} else {}
	}
	// ...
}

causes compile time errors. This would have been helpful to note in the Readme/docs.

Attempting the following: ```rust pub(crate) struct Args { cfg_if! { if #[cfg(feature = "my_feat")] { some_feature_gated_arg: u8, some_other_feature_gated_arg: u8, } else {} } // ... } ``` causes compile time errors. This would have been helpful to note in the Readme/docs.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-rust-lang/cfg-if#55
No description provided.