@@ -57,7 +57,7 @@ impl Display for CellId {
5757pub enum RawVc {
5858 TaskOutput ( TaskId ) ,
5959 TaskCell ( TaskId , CellId ) ,
60- LocalOutput ( TaskId , TaskPersistence , ExecutionId , LocalTaskId ) ,
60+ LocalOutput ( TaskPersistence , ExecutionId , LocalTaskId ) ,
6161}
6262
6363impl RawVc {
@@ -84,7 +84,7 @@ impl RawVc {
8484 pub fn is_transient ( & self ) -> bool {
8585 match self {
8686 RawVc :: TaskOutput ( task) | RawVc :: TaskCell ( task, ..) => task. is_transient ( ) ,
87- RawVc :: LocalOutput ( _ , persistence, ..) => * persistence == TaskPersistence :: Transient ,
87+ RawVc :: LocalOutput ( persistence, ..) => * persistence == TaskPersistence :: Transient ,
8888 }
8989 }
9090
@@ -148,7 +148,7 @@ impl RawVc {
148148 return Err ( ResolveTypeError :: NoContent ) ;
149149 }
150150 }
151- RawVc :: LocalOutput ( _task_id , _persistence, execution_id, local_task_id) => {
151+ RawVc :: LocalOutput ( _persistence, execution_id, local_task_id) => {
152152 current = read_local_output ( & * tt, execution_id, local_task_id)
153153 . await
154154 . map_err ( |source| ResolveTypeError :: TaskError { source } ) ?;
@@ -185,7 +185,7 @@ impl RawVc {
185185 consistency = ReadConsistency :: Eventual ;
186186 }
187187 RawVc :: TaskCell ( _, _) => return Ok ( current) ,
188- RawVc :: LocalOutput ( _task_id , _persistence, execution_id, local_task_id) => {
188+ RawVc :: LocalOutput ( _persistence, execution_id, local_task_id) => {
189189 debug_assert_eq ! ( consistency, ReadConsistency :: Eventual ) ;
190190 current = read_local_output ( & * tt, execution_id, local_task_id) . await ?;
191191 }
@@ -200,7 +200,7 @@ impl RawVc {
200200 let mut current = self ;
201201 loop {
202202 match current {
203- RawVc :: LocalOutput ( _task_id , _persistence, execution_id, local_task_id) => {
203+ RawVc :: LocalOutput ( _persistence, execution_id, local_task_id) => {
204204 current = read_local_output ( & * tt, execution_id, local_task_id) . await ?;
205205 }
206206 non_local => return Ok ( non_local) ,
@@ -209,13 +209,17 @@ impl RawVc {
209209 }
210210
211211 pub ( crate ) fn connect ( & self ) {
212+ let RawVc :: TaskOutput ( task_id) = self else {
213+ panic ! ( "RawVc::connect() must only be called on a RawVc::TaskOutput" ) ;
214+ } ;
212215 let tt = turbo_tasks ( ) ;
213- tt. connect_task ( self . get_task_id ( ) ) ;
216+ tt. connect_task ( * task_id ) ;
214217 }
215218
216- pub fn get_task_id ( & self ) -> TaskId {
219+ pub fn try_get_task_id ( & self ) -> Option < TaskId > {
217220 match self {
218- RawVc :: TaskOutput ( t) | RawVc :: TaskCell ( t, ..) | RawVc :: LocalOutput ( t, ..) => * t,
221+ RawVc :: TaskOutput ( t) | RawVc :: TaskCell ( t, ..) => Some ( * t) ,
222+ RawVc :: LocalOutput ( ..) => None ,
219223 }
220224 }
221225
@@ -250,20 +254,30 @@ impl RawVc {
250254/// This implementation of `CollectiblesSource` assumes that `self` is a `RawVc::TaskOutput`.
251255impl CollectiblesSource for RawVc {
252256 fn peek_collectibles < T : VcValueTrait + ?Sized > ( self ) -> AutoSet < ResolvedVc < T > > {
253- debug_assert ! ( matches!( self , RawVc :: TaskOutput ( ..) ) ) ;
257+ let RawVc :: TaskOutput ( task_id) = self else {
258+ panic ! (
259+ "<RawVc as CollectiblesSource>::peek_collectibles() must only be called on a \
260+ RawVc::TaskOutput"
261+ ) ;
262+ } ;
254263 let tt = turbo_tasks ( ) ;
255264 tt. notify_scheduled_tasks ( ) ;
256- let map = tt. read_task_collectibles ( self . get_task_id ( ) , T :: get_trait_type_id ( ) ) ;
265+ let map = tt. read_task_collectibles ( task_id , T :: get_trait_type_id ( ) ) ;
257266 map. into_iter ( )
258267 . filter_map ( |( raw, count) | ( count > 0 ) . then_some ( raw. try_into ( ) . unwrap ( ) ) )
259268 . collect ( )
260269 }
261270
262271 fn take_collectibles < T : VcValueTrait + ?Sized > ( self ) -> AutoSet < ResolvedVc < T > > {
263- debug_assert ! ( matches!( self , RawVc :: TaskOutput ( ..) ) ) ;
272+ let RawVc :: TaskOutput ( task_id) = self else {
273+ panic ! (
274+ "<RawVc as CollectiblesSource>::take_collectibles() must only be called on a \
275+ RawVc::TaskOutput"
276+ ) ;
277+ } ;
264278 let tt = turbo_tasks ( ) ;
265279 tt. notify_scheduled_tasks ( ) ;
266- let map = tt. read_task_collectibles ( self . get_task_id ( ) , T :: get_trait_type_id ( ) ) ;
280+ let map = tt. read_task_collectibles ( task_id , T :: get_trait_type_id ( ) ) ;
267281 tt. unemit_collectibles ( T :: get_trait_type_id ( ) , & map) ;
268282 map. into_iter ( )
269283 . filter_map ( |( raw, count) | ( count > 0 ) . then_some ( raw. try_into ( ) . unwrap ( ) ) )
@@ -360,7 +374,7 @@ impl Future for ReadRawVcFuture {
360374 Err ( err) => return Poll :: Ready ( Err ( err) ) ,
361375 }
362376 }
363- RawVc :: LocalOutput ( _task_id , _persistence, execution_id, local_output_id) => {
377+ RawVc :: LocalOutput ( _persistence, execution_id, local_output_id) => {
364378 debug_assert_eq ! ( this. consistency, ReadConsistency :: Eventual ) ;
365379 let read_result = tt. try_read_local_output ( execution_id, local_output_id) ;
366380 match read_result {
0 commit comments