Compile error when compiling for split keyboard without additional features
zUnixorn opened this issue · comments
Description of the issue
When compiling for a split keyboard and not having any of the "simple-backlight", "simple-backlight-matrix", "rgb-backlight-matrix", "underglow" features enabled, I get a the following compile error:
error[E0084]: unsupported representation for zero-variant enum
--> rumcake/rumcake/src/split/mod.rs:49:1
|
49 | #[repr(u8)]
| ^^^^^^^^^^^
50 | pub enum MessageToPeripheral {
| ---------------------------- zero-variant enum
Two possible fixes I thought of, would be either wrapping the repr(u8)
on MessageToPeripheral
in a cfg_attr
:
#[cfg_attr(any(
feature = "simple-backlight",
feature = "simple-backlight-matrix",
feature = "rgb-backlight-matrix",
feature = "underglow"
), repr(u8))]
or by adding a dummy variant to the enum, so it always has at least one variant, regardless enabled of features.
Hardware
Shouldn't work with other MCUs either, but in this case I tested it on an RP2040 and nRF52840 (split-template)
Version of rumcake
used
0.1.0 (a73d77b)
Minimum Reproducible Example
You can just use the split example and change the rev of rumcake to a73d77b
How to Reproduce
- use split example
- change the rev of rumcake to a73d77b
- compile
- observe compile error
Expected Behaviour
compile without errors when not specifying any additional features
Good catch, I have pushed up a fix, using cfg_attr
.