]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Recognize unstable as a builtin attribute
authorOwen Avery <powerboat9.gamer@gmail.com>
Tue, 26 Mar 2024 23:28:53 +0000 (19:28 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 1 Aug 2024 14:52:29 +0000 (16:52 +0200)
gcc/rust/ChangeLog:

* util/rust-attribute-values.h
(Attributes::UNSTABLE): New.
* util/rust-attributes.cc
(__definitions): Add Attributes::UNSTABLE.

gcc/testsuite/ChangeLog:

* rust/compile/unstable-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/unstable-fn.rs [new file with mode: 0644]

index 04aef99be68f32e18ef057799b5cbf1f02b41f7a..a8551c07dba6349dde0c240fa9d61a35763ee3d1 100644 (file)
@@ -52,6 +52,7 @@ public:
   static constexpr auto &RUSTC_INHERIT_OVERFLOW_CHECKS
     = "rustc_inherit_overflow_checks";
   static constexpr auto &STABLE = "stable";
+  static constexpr auto &UNSTABLE = "unstable";
 };
 } // namespace Values
 } // namespace Rust
index e10918b2f8d0ba3e2107f6574aa4fb32bcd22e1b..84d1781d0b360c4e7c4c70d0368f5283100ade0c 100644 (file)
@@ -60,7 +60,8 @@ static const BuiltinAttrDefinition __definitions[]
      // #![feature(rustc_attrs)]
      {Attrs::RUSTC_DEPRECATED, STATIC_ANALYSIS},
      {Attrs::RUSTC_INHERIT_OVERFLOW_CHECKS, CODE_GENERATION},
-     {Attrs::STABLE, STATIC_ANALYSIS}};
+     {Attrs::STABLE, STATIC_ANALYSIS},
+     {Attrs::UNSTABLE, STATIC_ANALYSIS}};
 
 BuiltinAttributeMappings *
 BuiltinAttributeMappings::get ()
diff --git a/gcc/testsuite/rust/compile/unstable-fn.rs b/gcc/testsuite/rust/compile/unstable-fn.rs
new file mode 100644 (file)
index 0000000..4cbbebd
--- /dev/null
@@ -0,0 +1,2 @@
+#[unstable(feature = "some_feature", issue = "12345")]
+pub fn foo() {}