aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2024-03-26 21:57:17 -0400
committerArthur Cohen <arthur.cohen@embecosm.com>2024-08-01 16:52:28 +0200
commitcde7407ec09fce2041f8e55f2408c2a55c0b05fa (patch)
tree074ff89857aa04827fd4dee974e2e6851d051e55 /gcc
parent3435f4e92b06747eb7d3777e8f60aa80bc495263 (diff)
downloadgcc-cde7407ec09fce2041f8e55f2408c2a55c0b05fa.zip
gcc-cde7407ec09fce2041f8e55f2408c2a55c0b05fa.tar.gz
gcc-cde7407ec09fce2041f8e55f2408c2a55c0b05fa.tar.bz2
gccrs: Recognize rustc_deprecated as a builtin attribute
gcc/rust/ChangeLog: * util/rust-attribute-values.h (Attributes::RUSTC_DEPRECATED): New. * util/rust-attributes.cc (__definitions): Add Attributes::RUSTC_DEPRECATED. gcc/testsuite/ChangeLog: * rust/compile/deprecated-fn.rs: New test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/util/rust-attribute-values.h1
-rw-r--r--gcc/rust/util/rust-attributes.cc1
-rw-r--r--gcc/testsuite/rust/compile/deprecated-fn.rs4
3 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-attribute-values.h b/gcc/rust/util/rust-attribute-values.h
index e284cec..04aef99 100644
--- a/gcc/rust/util/rust-attribute-values.h
+++ b/gcc/rust/util/rust-attribute-values.h
@@ -48,6 +48,7 @@ public:
static constexpr auto &TARGET_FEATURE = "target_feature";
// From now on, these are reserved by the compiler and gated through
// #![feature(rustc_attrs)]
+ static constexpr auto &RUSTC_DEPRECATED = "rustc_deprecated";
static constexpr auto &RUSTC_INHERIT_OVERFLOW_CHECKS
= "rustc_inherit_overflow_checks";
static constexpr auto &STABLE = "stable";
diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc
index eac2980..e10918b 100644
--- a/gcc/rust/util/rust-attributes.cc
+++ b/gcc/rust/util/rust-attributes.cc
@@ -58,6 +58,7 @@ static const BuiltinAttrDefinition __definitions[]
{Attrs::TARGET_FEATURE, CODE_GENERATION},
// From now on, these are reserved by the compiler and gated through
// #![feature(rustc_attrs)]
+ {Attrs::RUSTC_DEPRECATED, STATIC_ANALYSIS},
{Attrs::RUSTC_INHERIT_OVERFLOW_CHECKS, CODE_GENERATION},
{Attrs::STABLE, STATIC_ANALYSIS}};
diff --git a/gcc/testsuite/rust/compile/deprecated-fn.rs b/gcc/testsuite/rust/compile/deprecated-fn.rs
new file mode 100644
index 0000000..4083593
--- /dev/null
+++ b/gcc/testsuite/rust/compile/deprecated-fn.rs
@@ -0,0 +1,4 @@
+#![feature(rustc_attrs)]
+
+#[rustc_deprecated(since = "right now", reason = "a whim")]
+pub fn foo() {}