Doc attribute checking was not performed on traits.
gcc/rust/ChangeLog:
* util/rust-attributes.cc (check_doc_attribute): Change message.
(AttributeChecker::visit): Add doc attribute checking on traits.
gcc/testsuite/ChangeLog:
* rust/compile/attr_malformed_doc.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
{
rust_error_at (
attribute.get_locus (),
- // FIXME: Improve error message here. Rustc has a very good one
- "%<#[doc]%> cannot be an empty attribute");
+ "valid forms for the attribute are "
+ "%<#[doc(hidden|inline|...)]%> and %<#[doc = \" string \"]%>");
return;
}
AttributeChecker::visit (AST::Trait &trait)
{
check_proc_macro_non_function (trait.get_outer_attrs ());
+ check_attributes (trait.get_outer_attrs ());
}
void
--- /dev/null
+// { dg-error "valid forms for the attribute are ...doc.hidden.inline....... and ...doc = . string ..." "" { target *-*-* } .+1 }
+#[doc]
+trait MyTrait {}