File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
substrate/frame/contracts/src Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1625,13 +1625,13 @@ mod tests {
16251625 }
16261626
16271627 struct MockCtx < ' a > {
1628- ext : & ' a mut dyn Ext < T = Test > ,
1628+ ext : & ' a mut MockStack < ' a > ,
16291629 input_data : Vec < u8 > ,
16301630 }
16311631
16321632 #[ derive( Clone ) ]
16331633 struct MockExecutable {
1634- func : Rc < dyn Fn ( MockCtx , & Self ) -> ExecResult + ' static > ,
1634+ func : Rc < dyn for < ' a > Fn ( MockCtx < ' a > , & Self ) -> ExecResult + ' static > ,
16351635 func_type : ExportedFunction ,
16361636 code_hash : CodeHash < Test > ,
16371637 code_info : CodeInfo < Test > ,
@@ -1724,6 +1724,16 @@ mod tests {
17241724 if let & Constructor = function {
17251725 Self :: increment_refcount ( self . code_hash ) . unwrap ( ) ;
17261726 }
1727+ // # Safety
1728+ //
1729+ // We know that we **always** call execute with a `MockStack` in this test.
1730+ //
1731+ // # Note
1732+ //
1733+ // The transmute is necessary because `execute` has to be generic over all
1734+ // `E: Ext`. However, `MockExecutable` can't be generic over `E` as it would
1735+ // constitute a cycle.
1736+ let ext = unsafe { std:: mem:: transmute ( ext) } ;
17271737 if function == & self . func_type {
17281738 ( self . func ) ( MockCtx { ext, input_data } , & self )
17291739 } else {
You can’t perform that action at this time.
0 commit comments