aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorMuhammad Mahad <mahadtxt@gmail.com>2023-08-15 19:07:52 +0500
committerPhilip Herron <philip.herron@embecosm.com>2023-08-17 09:55:39 +0000
commitb9ae3541a16fef4f60daeee90dbbc7861f1b9584 (patch)
treed47973595b8d3ff000c387a9cd072051929b0945 /gcc/rust
parent3ef836fb091a14f083a31c009a9b89a6bfa9192c (diff)
downloadgcc-b9ae3541a16fef4f60daeee90dbbc7861f1b9584.zip
gcc-b9ae3541a16fef4f60daeee90dbbc7861f1b9584.tar.gz
gcc-b9ae3541a16fef4f60daeee90dbbc7861f1b9584.tar.bz2
gccrs: [E0535] Unknown argument given to inline attribute
The inline attribute only supports two arguments: - always - never All other arguments given to the inline attribute will return error. 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 message. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/backend/rust-compile-base.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index a907840..6911fa9 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -275,7 +275,11 @@ HIRCompileBase::handle_inline_attribute_on_fndecl (tree fndecl,
}
else
{
- rust_error_at (attr.get_locus (), "unknown inline option");
+ rich_location rich_locus (line_table, attr.get_locus ());
+ rich_locus.add_fixit_replace ("unknown inline option");
+ rust_error_at (rich_locus, ErrorCode::E0535,
+ "invalid argument, %<inline%> attribute only accepts "
+ "%<always%> or %<never%>");
}
}