In #[cfg_attr(A, B, C(D))], only A is a predicate.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::check_cfg_predicate):
Only check first item as a predicate.
gcc/testsuite/ChangeLog:
* rust/compile/cfg-attr.rs: New test.
Signed-off-by: Matthew Jasper <mjjasper1@gmail.com>
if (!is_parsed_to_meta_item ())
return false;
- return attr_input->check_cfg_predicate (session);
+ auto &meta_item = static_cast<AttrInputMetaItemContainer &> (*attr_input);
+ return meta_item.get_items ().front ()->check_cfg_predicate (session);
}
std::vector<Attribute>
--- /dev/null
+// { dg-additional-options "-w -frust-cfg=A" }
+#![cfg_attr(not(B), allow(dead_code))]
+#![cfg_attr(A, allow(while_true))]
+
+#[cfg_attr(not(B), allow(deprecated))]
+#[cfg_attr(A, allow(drop_bounds))]
+fn main() { }