Skip to content

Commit 48b250c

Browse files
committed
f
1 parent e03b036 commit 48b250c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

c-bindings-gen/src/types.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,19 @@ pub fn export_status(attrs: &[syn::Attribute]) -> ExportStatus {
6767
},
6868
TokenTree::Group(g) => {
6969
if format!("{}", single_ident_generic_path_to_ident(&attr.path).unwrap()) == "cfg" {
70-
if let TokenTree::Ident(i) = g.stream().into_iter().next().unwrap() {
71-
if i == "test" || i == "feature" {
70+
let mut iter = g.stream().into_iter();
71+
if let TokenTree::Ident(i) = iter.next().unwrap() {
72+
if i == "any" {
73+
// #[cfg(any(test, feature = ""))]
74+
if let TokenTree::Group(g) = iter.next().unwrap() {
75+
if let TokenTree::Ident(i) = g.stream().into_iter().next().unwrap() {
76+
if i == "test" || i == "feature" {
77+
// If its cfg(feature(...)) we assume its test-only
78+
return ExportStatus::TestOnly;
79+
}
80+
}
81+
}
82+
} else if i == "test" || i == "feature" {
7283
// If its cfg(feature(...)) we assume its test-only
7384
return ExportStatus::TestOnly;
7485
}

0 commit comments

Comments
 (0)