]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Recognize rustc_deprecated as a builtin attribute
authorOwen Avery <powerboat9.gamer@gmail.com>
Wed, 27 Mar 2024 01:57:17 +0000 (21:57 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 1 Aug 2024 14:52:28 +0000 (16:52 +0200)
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>
gcc/rust/util/rust-attribute-values.h
gcc/rust/util/rust-attributes.cc
gcc/testsuite/rust/compile/deprecated-fn.rs [new file with mode: 0644]

index e284cec1a1615da3bb149d44d3b5a285f5d4aa2b..04aef99be68f32e18ef057799b5cbf1f02b41f7a 100644 (file)
@@ -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";
index eac298082992950162726f4452e95015954e4a3e..e10918b2f8d0ba3e2107f6574aa4fb32bcd22e1b 100644 (file)
@@ -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 (file)
index 0000000..4083593
--- /dev/null
@@ -0,0 +1,4 @@
+#![feature(rustc_attrs)]
+
+#[rustc_deprecated(since = "right now", reason = "a whim")]
+pub fn foo() {}