This patch introduces the `exchange_malloc` lang item to compiler.
This lang item is a strict prerequisite for the `owned_box` lang item
and box expressions.
gcc/rust/ChangeLog:
* util/rust-lang-item.cc (Rust::LangItem::lang_items): Register
exchange_malloc to BiMap.
* util/rust-lang-item.h (LangItem::Kind): Add EXCHANGE_MALLOC.
gcc/testsuite/ChangeLog:
* rust/compile/exchange_malloc.rs: New test.
Signed-off-by: Enes Cevik <enes@nsvke.com>
{"discriminant_kind", Kind::DISCRIMINANT_KIND},
{"discriminant_type", Kind::DISCRIMINANT_TYPE},
{"manually_drop", Kind::MANUALLY_DROP},
+
+ {"exchange_malloc", Kind::EXCHANGE_MALLOC},
}};
tl::optional<LangItem::Kind>
DISCRIMINANT_KIND,
MANUALLY_DROP,
+
+ EXCHANGE_MALLOC
};
static const BiMap<std::string, Kind> lang_items;
--- /dev/null
+#![feature(no_core,lang_items)]
+#![no_core]
+
+#[lang = "exchange_malloc"]
+unsafe fn _allocate(_size: usize, _align: usize) -> *mut u8 {
+ 0 as *mut u8
+}