@@ -8,15 +8,18 @@ use rustc_index::vec::IndexVec;
88use rustc_macros:: HashStable ;
99use rustc_middle:: mir;
1010use rustc_middle:: mir:: interpret:: { InterpError , InvalidProgramInfo } ;
11- use rustc_middle:: ty:: layout:: { self , LayoutError , LayoutOf , LayoutOfHelpers , TyAndLayout } ;
11+ use rustc_middle:: ty:: layout:: {
12+ self , FnAbiError , FnAbiOfHelpers , FnAbiRequest , LayoutError , LayoutOf , LayoutOfHelpers ,
13+ TyAndLayout ,
14+ } ;
1215use rustc_middle:: ty:: {
1316 self , query:: TyCtxtAt , subst:: SubstsRef , ParamEnv , Ty , TyCtxt , TypeFoldable ,
1417} ;
1518use rustc_mir_dataflow:: storage:: AlwaysLiveLocals ;
1619use rustc_query_system:: ich:: StableHashingContext ;
1720use rustc_session:: Limit ;
1821use rustc_span:: { Pos , Span } ;
19- use rustc_target:: abi:: { Align , HasDataLayout , Size , TargetDataLayout } ;
22+ use rustc_target:: abi:: { call :: FnAbi , Align , HasDataLayout , Size , TargetDataLayout } ;
2023
2124use super :: {
2225 AllocId , GlobalId , Immediate , InterpErrorInfo , InterpResult , MPlaceTy , Machine , MemPlace ,
@@ -333,6 +336,22 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> LayoutOfHelpers<'tcx> for InterpC
333336 }
334337}
335338
339+ impl < ' mir , ' tcx : ' mir , M : Machine < ' mir , ' tcx > > FnAbiOfHelpers < ' tcx > for InterpCx < ' mir , ' tcx , M > {
340+ type FnAbiOfResult = InterpResult < ' tcx , & ' tcx FnAbi < ' tcx , Ty < ' tcx > > > ;
341+
342+ fn handle_fn_abi_err (
343+ & self ,
344+ err : FnAbiError < ' tcx > ,
345+ _span : Span ,
346+ _fn_abi_request : FnAbiRequest < ' tcx > ,
347+ ) -> InterpErrorInfo < ' tcx > {
348+ match err {
349+ FnAbiError :: Layout ( err) => err_inval ! ( Layout ( err) ) . into ( ) ,
350+ FnAbiError :: AdjustForForeignAbi ( err) => err_inval ! ( FnAbi ( err) ) . into ( ) ,
351+ }
352+ }
353+ }
354+
336355/// Test if it is valid for a MIR assignment to assign `src`-typed place to `dest`-typed value.
337356/// This test should be symmetric, as it is primarily about layout compatibility.
338357pub ( super ) fn mir_assign_valid_types < ' tcx > (
0 commit comments