[gccrs,COMMIT] lang: Add lang item exchange_malloc
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap |
success
|
Build passed
|
Commit Message
From: Enes Cevik <enes@nsvke.com>
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>
---
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/16a37ba94b143f0f1e9987d0380fca1ae309406f
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/4557
gcc/rust/util/rust-lang-item.cc | 2 ++
gcc/rust/util/rust-lang-item.h | 2 ++
gcc/testsuite/rust/compile/exchange_malloc.rs | 7 +++++++
3 files changed, 11 insertions(+)
create mode 100644 gcc/testsuite/rust/compile/exchange_malloc.rs
base-commit: cd9103fd3fe8d3726d5b4c30d30c7da265f53da3
@@ -120,6 +120,8 @@ const BiMap<std::string, LangItem::Kind> Rust::LangItem::lang_items = {{
{"discriminant_kind", Kind::DISCRIMINANT_KIND},
{"discriminant_type", Kind::DISCRIMINANT_TYPE},
{"manually_drop", Kind::MANUALLY_DROP},
+
+ {"exchange_malloc", Kind::EXCHANGE_MALLOC},
}};
tl::optional<LangItem::Kind>
@@ -156,6 +156,8 @@ public:
DISCRIMINANT_KIND,
MANUALLY_DROP,
+
+ EXCHANGE_MALLOC
};
static const BiMap<std::string, Kind> lang_items;
new file mode 100644
@@ -0,0 +1,7 @@
+#![feature(no_core,lang_items)]
+#![no_core]
+
+#[lang = "exchange_malloc"]
+unsafe fn _allocate(_size: usize, _align: usize) -> *mut u8 {
+ 0 as *mut u8
+}