Skip to content

Commit 2c6ee9d

Browse files
committed
gccrs: register the Drop lang item
gcc/rust/ChangeLog: * util/rust-lang-item.h: Add DROP. * util/rust-lang-item.cc: Add drop lang item. gcc/testsuite/ChangeLog: * rust/compile/drop-lang-item.rs: New test. Signed-off-by: lishin <lishin1008@gmail.com>
1 parent 98d729a commit 2c6ee9d

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

gcc/rust/util/rust-lang-item.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const BiMap<std::string, LangItem::Kind> Rust::LangItem::lang_items = {{
6262
{"fn_once_output", Kind::FN_ONCE_OUTPUT},
6363
{"copy", Kind::COPY},
6464
{"clone", Kind::CLONE},
65+
{"drop", Kind::DROP},
6566
{"sized", Kind::SIZED},
6667
{"sync", Kind::SYNC},
6768
{"slice_alloc", Kind::SLICE_ALLOC},

gcc/rust/util/rust-lang-item.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class LangItem
9090
// markers
9191
COPY,
9292
CLONE,
93+
DROP,
9394
SIZED,
9495
SYNC,
9596

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![feature(no_core)]
2+
#![no_core]
3+
4+
#![feature(lang_items)]
5+
6+
#[lang = "sized"]
7+
pub trait Sized {}
8+
9+
#[lang = "drop"]
10+
pub trait Drop {
11+
fn drop(&mut self);
12+
}
13+
14+
fn main() {}

0 commit comments

Comments
 (0)