Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gcc/rust/util/rust-attributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ check_doc_attribute (const AST::Attribute &attribute)
{
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;
}

Expand Down Expand Up @@ -807,6 +807,7 @@ void
AttributeChecker::visit (AST::Trait &trait)
{
check_proc_macro_non_function (trait.get_outer_attrs ());
check_attributes (trait.get_outer_attrs ());
}

void
Expand Down
3 changes: 3 additions & 0 deletions gcc/testsuite/rust/compile/attr_malformed_doc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// { dg-error "valid forms for the attribute are ...doc.hidden.inline....... and ...doc = . string ..." "" { target *-*-* } .+1 }
#[doc]
trait MyTrait {}
Loading