diff --git a/gcc/rust/util/rust-lang-item.cc b/gcc/rust/util/rust-lang-item.cc
index 37bd85b6b..21e2c81e9 100644
--- a/gcc/rust/util/rust-lang-item.cc
+++ b/gcc/rust/util/rust-lang-item.cc
@@ -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>
diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h
index 90d53a499..5a765282b 100644
--- a/gcc/rust/util/rust-lang-item.h
+++ b/gcc/rust/util/rust-lang-item.h
@@ -156,6 +156,8 @@ public:
     DISCRIMINANT_KIND,
 
     MANUALLY_DROP,
+
+    EXCHANGE_MALLOC
   };
 
   static const BiMap<std::string, Kind> lang_items;
diff --git a/gcc/testsuite/rust/compile/exchange_malloc.rs b/gcc/testsuite/rust/compile/exchange_malloc.rs
new file mode 100644
index 000000000..abfaabfb6
--- /dev/null
+++ b/gcc/testsuite/rust/compile/exchange_malloc.rs
@@ -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
+}
