@@ -81,6 +81,7 @@ fn clif_sig_from_fn_sig<'tcx>(
81
81
tcx : TyCtxt < ' tcx > ,
82
82
triple : & target_lexicon:: Triple ,
83
83
sig : FnSig < ' tcx > ,
84
+ span : Span ,
84
85
is_vtable_fn : bool ,
85
86
requires_caller_location : bool ,
86
87
) -> Signature {
@@ -118,7 +119,25 @@ fn clif_sig_from_fn_sig<'tcx>(
118
119
. layout_of ( ParamEnv :: reveal_all ( ) . and ( tcx. mk_mut_ptr ( tcx. mk_unit ( ) ) ) )
119
120
. unwrap ( ) ;
120
121
}
121
- get_pass_mode ( tcx, layout) . get_param_ty ( tcx) . into_iter ( )
122
+ let pass_mode = get_pass_mode ( tcx, layout) ;
123
+ if abi != Abi :: Rust && abi != Abi :: RustCall && abi != Abi :: RustIntrinsic {
124
+ match pass_mode {
125
+ PassMode :: NoPass | PassMode :: ByVal ( _) => { }
126
+ PassMode :: ByValPair ( _, _) | PassMode :: ByRef { sized : _ } => {
127
+ tcx. sess . span_warn (
128
+ span,
129
+ & format ! (
130
+ "Argument of type `{:?}` with pass mode `{:?}` is not yet supported \
131
+ for non-rust abi `{}`. Calling this function may result in a crash.",
132
+ layout. ty,
133
+ pass_mode,
134
+ abi,
135
+ ) ,
136
+ ) ;
137
+ }
138
+ }
139
+ }
140
+ pass_mode. get_param_ty ( tcx) . into_iter ( )
122
141
} )
123
142
. flatten ( ) ;
124
143
@@ -171,7 +190,7 @@ pub(crate) fn get_function_name_and_sig<'tcx>(
171
190
if fn_sig. c_variadic && !support_vararg {
172
191
tcx. sess . span_fatal ( tcx. def_span ( inst. def_id ( ) ) , "Variadic function definitions are not yet supported" ) ;
173
192
}
174
- let sig = clif_sig_from_fn_sig ( tcx, triple, fn_sig, false , inst. def . requires_caller_location ( tcx) ) ;
193
+ let sig = clif_sig_from_fn_sig ( tcx, triple, fn_sig, tcx . def_span ( inst . def_id ( ) ) , false , inst. def . requires_caller_location ( tcx) ) ;
175
194
( tcx. symbol_name ( inst) . name . as_str ( ) . to_string ( ) , sig)
176
195
}
177
196
@@ -584,6 +603,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
584
603
fx. tcx ,
585
604
fx. triple ( ) ,
586
605
fn_sig,
606
+ span,
587
607
is_virtual_call,
588
608
false , // calls through function pointers never pass the caller location
589
609
) ;
@@ -654,6 +674,7 @@ pub(crate) fn codegen_drop<'tcx>(
654
674
fx. tcx ,
655
675
fx. triple ( ) ,
656
676
fn_sig,
677
+ span,
657
678
true ,
658
679
false , // `drop_in_place` is never `#[track_caller]`
659
680
) ;
0 commit comments