public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] tests: add tests for deprecated attribute scanning Date: Thu, 30 Jun 2022 18:50:42 +0000 (GMT) [thread overview] Message-ID: <20220630185042.E820F383F977@sourceware.org> (raw) 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(); +}
reply other threads:[~2022-06-30 18:50 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220630185042.E820F383F977@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).