aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorMuhammad Mahad <mahadtxt@gmail.com>2023-08-15 18:52:10 +0500
committerPhilip Herron <philip.herron@embecosm.com>2023-08-16 09:28:41 +0000
commit5545c75fa5574fcc96717ba1656653621204fca2 (patch)
tree79ad39f77787f2d84e7374a69caa17092b2c0d2f /gcc/rust/backend
parent74b27ac68d857719fbe92fcd769ff89467ea253f (diff)
downloadgcc-5545c75fa5574fcc96717ba1656653621204fca2.zip
gcc-5545c75fa5574fcc96717ba1656653621204fca2.tar.gz
gcc-5545c75fa5574fcc96717ba1656653621204fca2.tar.bz2
gccrs: [E0534] inline attribute was malformed
Inline attribute takes one argument, but more than one argument was found. gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl): Added rich_location & error code. gcc/testsuite/ChangeLog: * rust/compile/inline_2.rs: Added new case. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-base.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index c2ac15d..a907840 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -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;
}