rust-lang / cfg-if

A if/elif-like macro for Rust #[cfg] statements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unexpected behavior inside struct, for feature-gated arguments

thor314 opened this issue · comments

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.