And just as a note, there's a new and quickly progressing RFC to allow #[cfg(false)]
for this purpose as well.
But unlike #if 0
, #[cfg(any())]
requires the decorated syntax to be well-formed. Defining a do-nothing macro (e.g. macro_rules! m {($($t:tt)*) => {}}
and putting code within an invocation thereof reduces the requirement to that the ignored tokens are a lexically valid token stream with matched paren/brackets.