avr-hal-generic: prefer compilation error for unsupported targets#624
avr-hal-generic: prefer compilation error for unsupported targets#624tones111 wants to merge 1 commit into
Conversation
The use of "unimplemented!" delays error detection until runtime, but the target architecture is known at compile time. By removing the unimplemented function we prevent unsupported architectures at compile-time.
9543d18 to
37b6f42
Compare
|
So far we've tried to keep On a different note, even if we were to introduce a compile-time error, I do not think that this is the proper way to do it: The resulting error message is extremely confusing and doesn't hint at the underlying problem at all. The proper way would be a crate-global cfg'ed avr-hal/mcu/atmega-hal/src/lib.rs Lines 27 to 48 in 3c08979 The tricky part is ensuring that such an error also short-circuits all other compiler errors that are caused by the same reason, to ensure clean and easy-to-navigate diagnostics. |
The build.rs logic is only used to detect a relatively old compiler version (Feb 2022). Since a nightly build is required to target AVR it's unlikely anyone is benefiting from this check. By removing it we reduce dependencies and implementation complexity.