gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::check_cfg_predicate): add cfg path in condition
gcc/testsuite/ChangeLog:
* rust/compile/issue-4261.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
auto &meta_item = static_cast<AttrInputMetaItemContainer &> (*attr_input);
if (meta_item.get_items ().empty ()
- && string_path == Values::Attributes::CFG_ATTR)
+ && (string_path == Values::Attributes::CFG
+ || string_path == Values::Attributes::CFG_ATTR))
{
- rust_error_at (path.get_locus (),
- "malformed %<cfg_attr%> attribute input");
+ rust_error_at (path.get_locus (), "malformed %<%s%> attribute input",
+ string_path.c_str ());
return false;
}
--- /dev/null
+#[cfg()]
+// { dg-error "malformed .cfg. attribute input" "" { target *-*-* } .-1 }
+fn a() {}