https://gcc.gnu.org/g:1c702629c57fc319cbb832c73504923011de5962
commit r17-1089-g1c702629c57fc319cbb832c73504923011de5962 Author: lishin <[email protected]> Date: Tue May 26 16:44:14 2026 +0000 gccrs: register the Drop lang item 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]> Diff: --- 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(+) diff --git a/gcc/rust/util/rust-lang-item.cc b/gcc/rust/util/rust-lang-item.cc index 9a167008dcdc..37bd85b6b673 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 da8266cb2617..90d53a4991ad 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 000000000000..8e0e0fdbbfad --- /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
