@@ -6,13 +6,11 @@ use rustc_hir as hir;
6
6
use rustc_hir:: def:: DefKind ;
7
7
use rustc_hir:: intravisit:: Visitor ;
8
8
use rustc_hir:: lang_items:: LangItem ;
9
- use rustc_hir:: { ImplicitSelfKind , ItemKind , Node } ;
10
9
use rustc_hir_analysis:: check:: fn_maybe_err;
11
10
use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
12
11
use rustc_infer:: infer:: RegionVariableOrigin ;
13
12
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
14
13
use rustc_span:: def_id:: LocalDefId ;
15
- use rustc_target:: spec:: abi:: Abi ;
16
14
use rustc_trait_selection:: traits;
17
15
use std:: cell:: RefCell ;
18
16
@@ -56,41 +54,6 @@ pub(super) fn check_fn<'a, 'tcx>(
56
54
57
55
fn_maybe_err ( tcx, span, fn_sig. abi ) ;
58
56
59
- if fn_sig. abi == Abi :: RustCall {
60
- let expected_args = if let ImplicitSelfKind :: None = decl. implicit_self { 1 } else { 2 } ;
61
-
62
- let err = || {
63
- let item = match tcx. hir ( ) . get ( fn_id) {
64
- Node :: Item ( hir:: Item { kind : ItemKind :: Fn ( header, ..) , .. } ) => Some ( header) ,
65
- Node :: ImplItem ( hir:: ImplItem {
66
- kind : hir:: ImplItemKind :: Fn ( header, ..) , ..
67
- } ) => Some ( header) ,
68
- Node :: TraitItem ( hir:: TraitItem {
69
- kind : hir:: TraitItemKind :: Fn ( header, ..) ,
70
- ..
71
- } ) => Some ( header) ,
72
- // Closures are RustCall, but they tuple their arguments, so shouldn't be checked
73
- Node :: Expr ( hir:: Expr { kind : hir:: ExprKind :: Closure { .. } , .. } ) => None ,
74
- node => bug ! ( "Item being checked wasn't a function/closure: {:?}" , node) ,
75
- } ;
76
-
77
- if let Some ( header) = item {
78
- tcx. sess . span_err ( header. span , "functions with the \" rust-call\" ABI must take a single non-self argument that is a tuple" ) ;
79
- }
80
- } ;
81
-
82
- if fn_sig. inputs ( ) . len ( ) != expected_args {
83
- err ( )
84
- } else {
85
- // FIXME(CraftSpider) Add a check on parameter expansion, so we don't just make the ICE happen later on
86
- // This will probably require wide-scale changes to support a TupleKind obligation
87
- // We can't resolve this without knowing the type of the param
88
- if !matches ! ( fn_sig. inputs( ) [ expected_args - 1 ] . kind( ) , ty:: Tuple ( _) | ty:: Param ( _) ) {
89
- err ( )
90
- }
91
- }
92
- }
93
-
94
57
if body. generator_kind . is_some ( ) && can_be_generator. is_some ( ) {
95
58
let yield_ty = fcx
96
59
. next_ty_var ( TypeVariableOrigin { kind : TypeVariableOriginKind :: TypeInference , span } ) ;
0 commit comments