public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-6222] gccrs: add lang item "phantom_data" Date: Tue, 21 Feb 2023 12:01:05 +0000 (GMT) [thread overview] Message-ID: <20230221120105.E120B384693C@sourceware.org> (raw) https://gcc.gnu.org/g:2fc01303604110de368cc115d951efa3d3a1963d commit r13-6222-g2fc01303604110de368cc115d951efa3d3a1963d Author: Raiki Tamura <tamaron1203@gmail.com> Date: Wed Nov 9 18:49:12 2022 +0900 gccrs: add lang item "phantom_data" gcc/rust/ChangeLog: * util/rust-lang-item.h: Add handling for `phantom_data` lang item. gcc/testsuite/ChangeLog: * rust/compile/torture/phantom_data.rs: New test. Diff: --- gcc/rust/util/rust-lang-item.h | 9 +++++++++ gcc/testsuite/rust/compile/torture/phantom_data.rs | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h index 02eeaee60df..ea0c91aa5f2 100644 --- a/gcc/rust/util/rust-lang-item.h +++ b/gcc/rust/util/rust-lang-item.h @@ -73,6 +73,9 @@ public: MUT_PTR, CONST_SLICE_PTR, + // https://github.com/rust-lang/rust/blob/master/library/core/src/marker.rs + PHANTOM_DATA, + // functions FN_ONCE, FN_ONCE_OUTPUT, @@ -222,6 +225,10 @@ public: { return ItemType::CONST_SLICE_PTR; } + else if (item.compare ("phantom_data") == 0) + { + return ItemType::PHANTOM_DATA; + } else if (item.compare ("fn_once") == 0) { return ItemType::FN_ONCE; @@ -308,6 +315,8 @@ public: return "mut_ptr"; case CONST_SLICE_PTR: return "const_slice_ptr"; + case PHANTOM_DATA: + return "phantom_data"; case FN_ONCE: return "fn_once"; case FN_ONCE_OUTPUT: diff --git a/gcc/testsuite/rust/compile/torture/phantom_data.rs b/gcc/testsuite/rust/compile/torture/phantom_data.rs new file mode 100644 index 00000000000..89e76aeb5eb --- /dev/null +++ b/gcc/testsuite/rust/compile/torture/phantom_data.rs @@ -0,0 +1,11 @@ +// { dg-options "-w" } +#[lang = "phantom_data"] +struct PhantomData<T>; + +trait Hash { + fn hash<H>(&self, state: &mut H); +} + +impl<T> Hash for PhantomData<T> { + fn hash<H>(&self, state: &mut H) {} +}
reply other threads:[~2023-02-21 12:01 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=20230221120105.E120B384693C@sourceware.org \ --to=cohenarthur@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).