]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
lang-item: Add Option::{None, Some}, Iterator::next, IntoIter::into_iter
authorArthur Cohen <arthur.cohen@embecosm.com>
Mon, 16 Dec 2024 13:17:29 +0000 (14:17 +0100)
committerCohenArthur <arthur.cohen@embecosm.com>
Tue, 31 Dec 2024 17:24:49 +0000 (17:24 +0000)
gcc/rust/ChangeLog:

* util/rust-lang-item.h: Add new lang items.
* util/rust-lang-item.cc: Likewise.

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

index 5a7bfd5f79c020eb55e6218f0fe764c6dd2cf1d0..76fcd348e3f48983be6b77fdf34df0bdc7155854 100644 (file)
@@ -92,6 +92,12 @@ const BiMap<std::string, LangItem::Kind> Rust::LangItem::lang_items = {{
   {"str", Kind::STR},
   {"f32_runtime", Kind::F32_RUNTIME},
   {"f64_runtime", Kind::F64_RUNTIME},
+
+  {"Some", Kind::OPTION_SOME},
+  {"None", Kind::OPTION_NONE},
+
+  {"into_iter", Kind::INTOITER_INTOITER},
+  {"next", Kind::ITERATOR_NEXT},
 }};
 
 tl::optional<LangItem::Kind>
index 18ba37dc22df0d94f6d683fb3f77bcf0746a22a3..5d57533499ee8f724fe543e1db76986a770f3f25 100644 (file)
@@ -26,6 +26,9 @@ namespace Rust {
 class LangItem
 {
 public:
+  // FIXME: We should clean up that enum to make it more inline with the list of
+  // lang-items in Rust 1.49
+  // https://github.com/rust-lang/rust/blob/1.49.0/compiler/rustc_hir/src/lang_items.rs
   enum class Kind
   {
     // https://github.com/rust-lang/rust/blob/master/library/core/src/ops/arith.rs
@@ -117,6 +120,12 @@ public:
     STR,
     F32_RUNTIME,
     F64_RUNTIME,
+
+    OPTION_SOME,
+    OPTION_NONE,
+
+    INTOITER_INTOITER,
+    ITERATOR_NEXT,
   };
 
   static const BiMap<std::string, Kind> lang_items;