@@ -12,7 +12,7 @@ use crate::{
1212 manager:: { read_local_output, read_task_cell, read_task_output, with_turbo_tasks} ,
1313 registry:: { self , get_value_type} ,
1414 turbo_tasks, CollectiblesSource , ReadCellOptions , ReadConsistency , ResolvedVc , TaskId ,
15- TraitTypeId , ValueType , ValueTypeId , VcValueTrait ,
15+ TaskPersistence , TraitTypeId , ValueType , ValueTypeId , VcValueTrait ,
1616} ;
1717
1818#[ derive( Error , Debug ) ]
@@ -57,31 +57,34 @@ impl Display for CellId {
5757pub enum RawVc {
5858 TaskOutput ( TaskId ) ,
5959 TaskCell ( TaskId , CellId ) ,
60- LocalOutput ( TaskId , LocalTaskId ) ,
60+ LocalOutput ( TaskId , TaskPersistence , LocalTaskId ) ,
6161}
6262
6363impl RawVc {
6464 pub fn is_resolved ( & self ) -> bool {
6565 match self {
66- RawVc :: TaskOutput ( _ ) => false ,
67- RawVc :: TaskCell ( _ , _ ) => true ,
68- RawVc :: LocalOutput ( _ , _ ) => false ,
66+ RawVc :: TaskOutput ( .. ) => false ,
67+ RawVc :: TaskCell ( .. ) => true ,
68+ RawVc :: LocalOutput ( .. ) => false ,
6969 }
7070 }
7171
7272 pub fn is_local ( & self ) -> bool {
7373 match self {
74- RawVc :: TaskOutput ( _ ) => false ,
75- RawVc :: TaskCell ( _ , _ ) => false ,
76- RawVc :: LocalOutput ( _ , _ ) => true ,
74+ RawVc :: TaskOutput ( .. ) => false ,
75+ RawVc :: TaskCell ( .. ) => false ,
76+ RawVc :: LocalOutput ( .. ) => true ,
7777 }
7878 }
7979
80+ /// Returns `true` if the task this `RawVc` reads from cannot be serialized and will not be
81+ /// stored in the persistent cache.
82+ ///
83+ /// See [`TaskPersistence`] for more details.
8084 pub fn is_transient ( & self ) -> bool {
8185 match self {
82- RawVc :: TaskOutput ( task) | RawVc :: TaskCell ( task, _) | RawVc :: LocalOutput ( task, _) => {
83- task. is_transient ( )
84- }
86+ RawVc :: TaskOutput ( task) | RawVc :: TaskCell ( task, ..) => task. is_transient ( ) ,
87+ RawVc :: LocalOutput ( _, persistence, ..) => * persistence == TaskPersistence :: Transient ,
8588 }
8689 }
8790
@@ -145,7 +148,7 @@ impl RawVc {
145148 return Err ( ResolveTypeError :: NoContent ) ;
146149 }
147150 }
148- RawVc :: LocalOutput ( task_id, local_task_id) => {
151+ RawVc :: LocalOutput ( task_id, _persistence , local_task_id) => {
149152 current = read_local_output ( & * tt, task_id, local_task_id)
150153 . await
151154 . map_err ( |source| ResolveTypeError :: TaskError { source } ) ?;
@@ -182,7 +185,7 @@ impl RawVc {
182185 consistency = ReadConsistency :: Eventual ;
183186 }
184187 RawVc :: TaskCell ( _, _) => return Ok ( current) ,
185- RawVc :: LocalOutput ( task_id, local_task_id) => {
188+ RawVc :: LocalOutput ( task_id, _persistence , local_task_id) => {
186189 debug_assert_eq ! ( consistency, ReadConsistency :: Eventual ) ;
187190 current = read_local_output ( & * tt, task_id, local_task_id) . await ?;
188191 }
@@ -197,7 +200,7 @@ impl RawVc {
197200 let mut current = self ;
198201 loop {
199202 match current {
200- RawVc :: LocalOutput ( task_id, local_task_id) => {
203+ RawVc :: LocalOutput ( task_id, _persistence , local_task_id) => {
201204 current = read_local_output ( & * tt, task_id, local_task_id) . await ?;
202205 }
203206 non_local => return Ok ( non_local) ,
@@ -212,14 +215,14 @@ impl RawVc {
212215
213216 pub fn get_task_id ( & self ) -> TaskId {
214217 match self {
215- RawVc :: TaskOutput ( t) | RawVc :: TaskCell ( t, _) | RawVc :: LocalOutput ( t, _ ) => * t,
218+ RawVc :: TaskOutput ( t) | RawVc :: TaskCell ( t, _) | RawVc :: LocalOutput ( t, .. ) => * t,
216219 }
217220 }
218221
219222 pub fn try_get_type_id ( & self ) -> Option < ValueTypeId > {
220223 match self {
221224 RawVc :: TaskCell ( _, CellId { type_id, .. } ) => Some ( * type_id) ,
222- RawVc :: TaskOutput ( _) | RawVc :: LocalOutput ( _ , _ ) => None ,
225+ RawVc :: TaskOutput ( _) | RawVc :: LocalOutput ( .. ) => None ,
223226 }
224227 }
225228
@@ -357,7 +360,7 @@ impl Future for ReadRawVcFuture {
357360 Err ( err) => return Poll :: Ready ( Err ( err) ) ,
358361 }
359362 }
360- RawVc :: LocalOutput ( task_id, local_output_id) => {
363+ RawVc :: LocalOutput ( task_id, _persistence , local_output_id) => {
361364 debug_assert_eq ! ( this. consistency, ReadConsistency :: Eventual ) ;
362365 let read_result = tt. try_read_local_output ( task_id, local_output_id) ;
363366 match read_result {
0 commit comments