Skip to content

Commit

Permalink
Recognize unstable as a builtin attribute
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
powerboat9 authored and CohenArthur committed Mar 27, 2024
1 parent 581c430 commit fd621e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions gcc/rust/util/rust-attribute-values.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Attributes
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
Expand Down
3 changes: 2 additions & 1 deletion gcc/rust/util/rust-attributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
2 changes: 2 additions & 0 deletions gcc/testsuite/rust/compile/unstable-fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[unstable(feature = "some_feature", issue = "12345")]
pub fn foo() {}

0 comments on commit fd621e1

Please sign in to comment.