]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/lang_items.rs
rollup merge of #17355 : gamazeps/issue17210
[rust.git] / src / librustc / middle / lang_items.rs
index 24782240f06c4d3a58b30a24e11bfcf8188f4837..daba3b701c03bdac4e8907a6040e04b903f21a51 100644 (file)
@@ -85,6 +85,17 @@ pub fn require(&self, it: LangItem) -> Result<ast::DefId, String> {
         }
     }
 
+    pub fn from_builtin_kind(&self, bound: ty::BuiltinBound)
+                             -> Result<ast::DefId, String>
+    {
+        match bound {
+            ty::BoundSend => self.require(SendTraitLangItem),
+            ty::BoundSized => self.require(SizedTraitLangItem),
+            ty::BoundCopy => self.require(CopyTraitLangItem),
+            ty::BoundSync => self.require(SyncTraitLangItem),
+        }
+    }
+
     pub fn to_builtin_kind(&self, id: ast::DefId) -> Option<ty::BuiltinBound> {
         if Some(id) == self.send_trait() {
             Some(ty::BoundSend)
@@ -236,6 +247,8 @@ pub fn collect_language_items(krate: &ast::Crate,
     ShrTraitLangItem,                "shr",                     shr_trait;
     IndexTraitLangItem,              "index",                   index_trait;
     IndexMutTraitLangItem,           "index_mut",               index_mut_trait;
+    SliceTraitLangItem,              "slice",                   slice_trait;
+    SliceMutTraitLangItem,           "slice_mut",               slice_mut_trait;
 
     UnsafeTypeLangItem,              "unsafe",                  unsafe_type;
 
@@ -265,7 +278,6 @@ pub fn collect_language_items(krate: &ast::Crate,
     BeginUnwindLangItem,             "begin_unwind",            begin_unwind;
 
     ExchangeMallocFnLangItem,        "exchange_malloc",         exchange_malloc_fn;
-    ClosureExchangeMallocFnLangItem, "closure_exchange_malloc", closure_exchange_malloc_fn;
     ExchangeFreeFnLangItem,          "exchange_free",           exchange_free_fn;
     MallocFnLangItem,                "malloc",                  malloc_fn;
     FreeFnLangItem,                  "free",                    free_fn;