Closed
Description
See rust-lang/rfcs#2523 (comment), where @ogoffart mentions that:
I suppose it would not make sense to relax the parsing rules of items that are disabled by #[cfg]
So one must wrap the item inside a macro such as cfg-if!{...} but which would not expand the items for the disabled configuration. Something like this should work: #[cfg(
$cfg)] identity!{ $ ($body)* }.
Currently in libc we can't write:
cfg_if! {
if #[cfg(foo)] {
#[repr(align(16))] struct F;
}
}
because older libsyntax versions chuckle on the align(16)
(https://rust.godbolt.org/z/eZYANH). It would be nice if cfg_if!
could be improved with such an indirect macro approach to make that work.
Metadata
Metadata
Assignees
Labels
No labels