Skip to content

Add lang item exchange_malloc#4557

Open
nsvke wants to merge 1 commit into
Rust-GCC:masterfrom
nsvke:add-lang-exchange-malloc
Open

Add lang item exchange_malloc#4557
nsvke wants to merge 1 commit into
Rust-GCC:masterfrom
nsvke:add-lang-exchange-malloc

Conversation

@nsvke
Copy link
Copy Markdown
Contributor

@nsvke nsvke commented May 26, 2026

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: Registor exchange_malloc to BiMap.
* util/rust-lang-item.h: Add EXCHANGE_MALLOC to LangItem class.

gcc/testsuite/ChangeLog:

* rust/compile/exchange_malloc.rs: New test.

@dkm
Copy link
Copy Markdown
Member

dkm commented May 27, 2026

Please adjust changelog to point at the elements being change, not only the file. A bit like:

* file.cc ( Rust::LangItem::lang_items)<exchange_malloc>: Add.

or

* file.cc ( Rust::LangItem::lang_items): Add exchange_malloc....

Same comment for both file :)

@nsvke nsvke force-pushed the add-lang-exchange-malloc branch from da48a4e to c95002a Compare May 27, 2026 10:06
Copy link
Copy Markdown
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done :)

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>
@nsvke nsvke force-pushed the add-lang-exchange-malloc branch from c95002a to 21f8d69 Compare May 27, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants