@@ -73,7 +73,13 @@ pub trait TurboTasksCallApi: Sync + Send {
7373 arg : Box < dyn MagicAny > ,
7474 persistence : TaskPersistence ,
7575 ) -> RawVc ;
76-
76+ fn devirtualized_trait_call (
77+ & self ,
78+ trait_impl : & ' static NativeFunction ,
79+ this : RawVc ,
80+ arg : Box < dyn MagicAny > ,
81+ persistence : TaskPersistence ,
82+ ) -> RawVc ;
7783 fn run (
7884 & self ,
7985 future : Pin < Box < dyn Future < Output = Result < ( ) > > + Send + ' static > > ,
@@ -656,6 +662,17 @@ impl<B: Backend + 'static> TurboTasks<B> {
656662 self . schedule_local_task ( task_type, persistence)
657663 }
658664
665+ pub fn devirtualized_trait_call (
666+ & self ,
667+ trait_impl : & ' static NativeFunction ,
668+ this : RawVc ,
669+ arg : Box < dyn MagicAny > ,
670+ persistence : TaskPersistence ,
671+ ) -> RawVc {
672+ let arg = trait_impl. arg_meta . filter_owned ( arg) ;
673+ return self . dynamic_call ( trait_impl, Some ( this) , arg, persistence) ;
674+ }
675+
659676 pub fn trait_call (
660677 & self ,
661678 trait_method : & ' static TraitMethod ,
@@ -1183,7 +1200,15 @@ impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B> {
11831200 ) -> RawVc {
11841201 self . trait_call ( trait_method, this, arg, persistence)
11851202 }
1186-
1203+ fn devirtualized_trait_call (
1204+ & self ,
1205+ trait_impl : & ' static NativeFunction ,
1206+ this : RawVc ,
1207+ arg : Box < dyn MagicAny > ,
1208+ persistence : TaskPersistence ,
1209+ ) -> RawVc {
1210+ self . devirtualized_trait_call ( trait_impl, this, arg, persistence)
1211+ }
11871212 #[ track_caller]
11881213 fn run (
11891214 & self ,
@@ -1579,6 +1604,15 @@ pub fn trait_call(
15791604) -> RawVc {
15801605 with_turbo_tasks ( |tt| tt. trait_call ( trait_method, this, arg, persistence) )
15811606}
1607+ /// Calls [`TurboTasks::devirtualized_trait_call`] for the current turbo tasks instance.
1608+ pub fn devirtualized_trait_call (
1609+ trait_impl : & ' static NativeFunction ,
1610+ this : RawVc ,
1611+ arg : Box < dyn MagicAny > ,
1612+ persistence : TaskPersistence ,
1613+ ) -> RawVc {
1614+ with_turbo_tasks ( |tt| tt. devirtualized_trait_call ( trait_impl, this, arg, persistence) )
1615+ }
15821616
15831617pub fn turbo_tasks ( ) -> Arc < dyn TurboTasksApi > {
15841618 TURBO_TASKS . with ( |arc| arc. clone ( ) )
0 commit comments