From: lishin <[email protected]>
gcc/rust/ChangeLog:
* util/rust-lang-item.h (Rust::LangItem::Kind): Add DROP.
* util/rust-lang-item.cc (Rust::LangItem::lang_items): Add drop lang
item.
gcc/testsuite/ChangeLog:
* rust/compile/drop-lang-item.rs: New test.
Signed-off-by: lishin <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github:
https://github.com/Rust-GCC/gccrs/commit/954e0795be0d8c172b7de6d606ea4ed48ab557d2
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4559
gcc/rust/util/rust-lang-item.cc | 1 +
gcc/rust/util/rust-lang-item.h | 1 +
gcc/testsuite/rust/compile/drop-lang-item.rs | 14 ++++++++++++++
3 files changed, 16 insertions(+)
create mode 100644 gcc/testsuite/rust/compile/drop-lang-item.rs
diff --git a/gcc/rust/util/rust-lang-item.cc b/gcc/rust/util/rust-lang-item.cc
index 9a167008d..37bd85b6b 100644
--- a/gcc/rust/util/rust-lang-item.cc
+++ b/gcc/rust/util/rust-lang-item.cc
@@ -62,6 +62,7 @@ const BiMap<std::string, LangItem::Kind>
Rust::LangItem::lang_items = {{
{"fn_once_output", Kind::FN_ONCE_OUTPUT},
{"copy", Kind::COPY},
{"clone", Kind::CLONE},
+ {"drop", Kind::DROP},
{"sized", Kind::SIZED},
{"sync", Kind::SYNC},
{"slice_alloc", Kind::SLICE_ALLOC},
diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h
index da8266cb2..90d53a499 100644
--- a/gcc/rust/util/rust-lang-item.h
+++ b/gcc/rust/util/rust-lang-item.h
@@ -90,6 +90,7 @@ public:
// markers
COPY,
CLONE,
+ DROP,
SIZED,
SYNC,
diff --git a/gcc/testsuite/rust/compile/drop-lang-item.rs
b/gcc/testsuite/rust/compile/drop-lang-item.rs
new file mode 100644
index 000000000..8e0e0fdbb
--- /dev/null
+++ b/gcc/testsuite/rust/compile/drop-lang-item.rs
@@ -0,0 +1,14 @@
+#![feature(no_core)]
+#![no_core]
+
+#![feature(lang_items)]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+#[lang = "drop"]
+pub trait Drop {
+ fn drop(&mut self);
+}
+
+fn main() {}
\ No newline at end of file
base-commit: 5c63b4c0d93d20efd014ccfd4250d82e27c3a23b
--
2.54.0