@@ -321,9 +321,7 @@ impl<T: VmType> VmType for Unrooted<T> {
321321 T :: make_type ( vm)
322322 }
323323
324- fn extra_args ( ) -> VmIndex {
325- T :: extra_args ( )
326- }
324+ const EXTRA_ARGS : VmIndex = T :: EXTRA_ARGS ;
327325}
328326impl < ' vm , T : VmType > Pushable < ' vm > for Unrooted < T > {
329327 fn push ( self , context : & mut ActiveThread < ' vm > ) -> Result < ( ) > {
@@ -460,9 +458,7 @@ pub trait VmType {
460458 /// How many extra arguments a function returning this type requires.
461459 /// Used for abstract types which when used in return position should act like they still need
462460 /// more arguments before they are called
463- fn extra_args ( ) -> VmIndex {
464- 0
465- }
461+ const EXTRA_ARGS : VmIndex = 0 ;
466462}
467463
468464/// Trait which allows a possibly asynchronous rust value to be pushed to the virtual machine
@@ -617,9 +613,7 @@ impl<'vm, T: ?Sized + VmType> VmType for PhantomData<T> {
617613 fn make_type ( vm : & Thread ) -> ArcType {
618614 T :: make_type ( vm)
619615 }
620- fn extra_args ( ) -> VmIndex {
621- T :: extra_args ( )
622- }
616+ const EXTRA_ARGS : VmIndex = T :: EXTRA_ARGS ;
623617}
624618
625619/// Wrapper which extracts a `Userdata` value from gluon
@@ -640,9 +634,7 @@ where
640634 T :: make_forall_type ( vm)
641635 }
642636
643- fn extra_args ( ) -> VmIndex {
644- T :: extra_args ( )
645- }
637+ const EXTRA_ARGS : VmIndex = T :: EXTRA_ARGS ;
646638}
647639
648640impl < ' vm , ' value , T > Getable < ' vm , ' value > for UserdataValue < T >
@@ -783,9 +775,7 @@ where
783775 T :: make_type ( vm)
784776 }
785777
786- fn extra_args ( ) -> VmIndex {
787- T :: extra_args ( )
788- }
778+ const EXTRA_ARGS : VmIndex = T :: EXTRA_ARGS ;
789779}
790780
791781impl < ' vm , T > Pushable < ' vm > for WithVM < ' vm , T >
@@ -1470,9 +1460,7 @@ where
14701460 fn make_type ( vm : & Thread ) -> ArcType {
14711461 <F :: Output >:: make_type ( vm)
14721462 }
1473- fn extra_args ( ) -> VmIndex {
1474- <F :: Output >:: extra_args ( )
1475- }
1463+ const EXTRA_ARGS : VmIndex = F :: Output :: EXTRA_ARGS ;
14761464}
14771465
14781466impl < ' vm , F > AsyncPushable < ' vm > for FutureResult < F >
@@ -1519,9 +1507,7 @@ impl<T: VmType, E> VmType for RuntimeResult<T, E> {
15191507 T :: make_type ( vm)
15201508 }
15211509
1522- fn extra_args ( ) -> VmIndex {
1523- T :: extra_args ( )
1524- }
1510+ const EXTRA_ARGS : VmIndex = T :: EXTRA_ARGS ;
15251511}
15261512impl < ' vm , T : Pushable < ' vm > , E : fmt:: Display > Pushable < ' vm > for RuntimeResult < T , E > {
15271513 fn push ( self , context : & mut ActiveThread < ' vm > ) -> Result < ( ) > {
@@ -1552,9 +1538,8 @@ where
15521538 let alias = env. find_type_info ( "std.io.IO" ) . unwrap ( ) ;
15531539 Type :: app ( alias. into_type ( ) , collect ! [ T :: make_type( vm) ] )
15541540 }
1555- fn extra_args ( ) -> VmIndex {
1556- 1
1557- }
1541+
1542+ const EXTRA_ARGS : VmIndex = 1 ;
15581543}
15591544
15601545impl < ' vm , ' value , T : Getable < ' vm , ' value > > Getable < ' vm , ' value > for IO < T > {
@@ -1750,9 +1735,7 @@ impl<T: VmType> VmType for Pushed<T> {
17501735 T :: make_forall_type ( vm)
17511736 }
17521737
1753- fn extra_args ( ) -> VmIndex {
1754- T :: extra_args ( )
1755- }
1738+ const EXTRA_ARGS : VmIndex = T :: EXTRA_ARGS ;
17561739}
17571740
17581741impl < ' vm , T : VmType > Pushable < ' vm > for Pushed < T > {
0 commit comments