public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] tests: add tests for deprecated attribute scanning
@ 2022-06-30 18:50 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-30 18:50 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0c290e7c6f3a227829ffe70d8fd9280f1a1da668
commit 0c290e7c6f3a227829ffe70d8fd9280f1a1da668
Author: liushuyu <liushuyu011@gmail.com>
Date: Sat Jun 11 20:27:46 2022 -0600
tests: add tests for deprecated attribute scanning
Diff:
---
gcc/testsuite/rust/compile/attr_deprecated.rs | 14 ++++++++++++++
gcc/testsuite/rust/compile/attr_deprecated_2.rs | 11 +++++++++++
2 files changed, 25 insertions(+)
diff --git a/gcc/testsuite/rust/compile/attr_deprecated.rs b/gcc/testsuite/rust/compile/attr_deprecated.rs
new file mode 100644
index 00000000000..01bc9c41502
--- /dev/null
+++ b/gcc/testsuite/rust/compile/attr_deprecated.rs
@@ -0,0 +1,14 @@
+#[deprecated(since="1.0", note="do not use this function")]
+fn test1() {}
+
+#[deprecated]
+fn test() {}
+
+#[deprecated = "a different message"]
+fn test2() {}
+
+fn main() {
+ test(); // { dg-warning ".attr_deprecated::test. is deprecated" }
+ test1(); // { dg-warning ".attr_deprecated::test1. is deprecated: do not use this function" }
+ test2(); // { dg-warning ".attr_deprecated::test2. is deprecated: a different message" }
+}
diff --git a/gcc/testsuite/rust/compile/attr_deprecated_2.rs b/gcc/testsuite/rust/compile/attr_deprecated_2.rs
new file mode 100644
index 00000000000..66f4ce3b076
--- /dev/null
+++ b/gcc/testsuite/rust/compile/attr_deprecated_2.rs
@@ -0,0 +1,11 @@
+#[deprecated(since="1.0")]
+fn test1() {}
+
+// { dg-excess-errors "unknown meta item ...." }
+#[deprecated(invalid="invalid")]
+fn test2() {}
+
+fn main() {
+ test1(); // { dg-warning ".attr_deprecated_2::test1. is deprecated" }
+ test2();
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-30 18:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 18:50 [gcc/devel/rust/master] tests: add tests for deprecated attribute scanning Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).