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: 4 additions & 1 deletion gcc/rust/backend/rust-compile-base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ HIRCompileBase::handle_inline_attribute_on_fndecl (tree fndecl,
AST::AttrInputMetaItemContainer *meta_item = option.parse_to_meta_item ();
if (meta_item->get_items ().size () != 1)
{
rust_error_at (attr.get_locus (), "invalid number of arguments");
rich_location rich_locus (line_table, attr.get_locus ());
rich_locus.add_fixit_replace ("expected one argument");
rust_error_at (rich_locus, ErrorCode::E0534,
"invalid number of arguments");
return;
}

Expand Down
3 changes: 3 additions & 0 deletions gcc/testsuite/rust/compile/inline_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ fn test_a() {}

#[inline(A, B)] // { dg-error "invalid number of arguments" }
fn test_b() {}

#[inline()] // { dg-error "invalid number of arguments" }
fn test_c() {}