diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-01-31 14:39:29 +0000 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2023-04-06 10:47:21 +0200 |
commit | f62dcf2c65a66615321acdf73f0f4c8a9ce679f9 (patch) | |
tree | 79a78ac5e6eaf11b807849e69c195f9c010e1dcc /gcc/testsuite/rust | |
parent | 2a2e6712ba03437857c1b39ed0ce1ca7b0974318 (diff) | |
download | gcc-f62dcf2c65a66615321acdf73f0f4c8a9ce679f9.zip gcc-f62dcf2c65a66615321acdf73f0f4c8a9ce679f9.tar.gz gcc-f62dcf2c65a66615321acdf73f0f4c8a9ce679f9.tar.bz2 |
gccrs: Add missing Sized, Copy and Clone lang item mappings
We need these lang items to be defined and later down the line the mappings
will be used to implement proper copy and clone logic.
Fixes #1786
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
* util/rust-lang-item.h:
gcc/testsuite/ChangeLog:
* rust/compile/issue-1786.rs: New test.
Diffstat (limited to 'gcc/testsuite/rust')
-rw-r--r-- | gcc/testsuite/rust/compile/issue-1786.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-1786.rs b/gcc/testsuite/rust/compile/issue-1786.rs new file mode 100644 index 0000000..f73b63d --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1786.rs @@ -0,0 +1,23 @@ +#[lang = "clone"] +trait Clone { + fn clone(&self) -> Self; + + fn clone_from(&mut self, source: &Self) { + *self = source.clone() + } +} + +#[lang = "copy"] +pub trait Copy: Clone { + // Empty. +} + +mod impls { + use super::Clone; + + impl Clone for char { + fn clone(&self) -> Self { + *self + } + } +} |