Skip to content

Commit

Permalink
Recognize rustc_deprecated as a builtin attribute
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
powerboat9 authored and CohenArthur committed Mar 27, 2024
1 parent 67928be commit 581c430
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
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 @@ -48,6 +48,7 @@ class Attributes
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";
Expand Down
1 change: 1 addition & 0 deletions gcc/rust/util/rust-attributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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}};

Expand Down
4 changes: 4 additions & 0 deletions gcc/testsuite/rust/compile/deprecated-fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![feature(rustc_attrs)]

#[rustc_deprecated(since = "right now", reason = "a whim")]
pub fn foo() {}

0 comments on commit 581c430

Please sign in to comment.