]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/callee.rs
Rollup merge of #104003 - c410-f3r:moar-errors, r=petrochenkov
[rust.git] / compiler / rustc_hir_typeck / src / callee.rs
index 000f4c9b684279f1552e8c9bb2741caca3f02254..2b019c8c9b7a581f09facce0ee0c90845c9ebe0c 100644 (file)
@@ -468,6 +468,22 @@ fn confirm_builtin_call(
             def_id,
         );
 
+        if fn_sig.abi == abi::Abi::RustCall {
+            let sp = arg_exprs.last().map_or(call_expr.span, |expr| expr.span);
+            if let Some(ty) = fn_sig.inputs().last().copied() {
+                self.register_bound(
+                    ty,
+                    self.tcx.require_lang_item(hir::LangItem::Tuple, Some(sp)),
+                    traits::ObligationCause::new(sp, self.body_id, traits::RustCall),
+                );
+            } else {
+                self.tcx.sess.span_err(
+                        sp,
+                        "functions with the \"rust-call\" ABI must take a single non-self tuple argument",
+                    );
+            }
+        }
+
         fn_sig.output()
     }