X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Frustc_hir_typeck%2Fsrc%2Fcallee.rs;h=2b019c8c9b7a581f09facce0ee0c90845c9ebe0c;hb=c5903969145660350d2e7c7e4757c83949beccb7;hp=000f4c9b684279f1552e8c9bb2741caca3f02254;hpb=58f5d57b5d622c87af4aaba45ab434ebcd867b20;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index 000f4c9b684..2b019c8c9b7 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -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() }