]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: 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)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:55:44 +0000 (12:55 +0100)
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 216202af92668ed04f13693899a93598413c0765..c4c1d1c093ab2eed76183680aa28bdee84cd280d 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 66d26d03907c0db8410ccf1811f1e1edee70b9e6..9e432e2ccc6e7ca03a276abf2f9c777bd3b009bb 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;