@@ -12,7 +12,7 @@ use crate::{
12
12
manager:: { read_local_output, read_task_cell, read_task_output, with_turbo_tasks} ,
13
13
registry:: { self , get_value_type} ,
14
14
turbo_tasks, CollectiblesSource , ReadCellOptions , ReadConsistency , ResolvedVc , TaskId ,
15
- TraitTypeId , ValueType , ValueTypeId , VcValueTrait ,
15
+ TaskPersistence , TraitTypeId , ValueType , ValueTypeId , VcValueTrait ,
16
16
} ;
17
17
18
18
#[ derive( Error , Debug ) ]
@@ -57,31 +57,34 @@ impl Display for CellId {
57
57
pub enum RawVc {
58
58
TaskOutput ( TaskId ) ,
59
59
TaskCell ( TaskId , CellId ) ,
60
- LocalOutput ( TaskId , LocalTaskId ) ,
60
+ LocalOutput ( TaskId , TaskPersistence , LocalTaskId ) ,
61
61
}
62
62
63
63
impl RawVc {
64
64
pub fn is_resolved ( & self ) -> bool {
65
65
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 ,
69
69
}
70
70
}
71
71
72
72
pub fn is_local ( & self ) -> bool {
73
73
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 ,
77
77
}
78
78
}
79
79
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.
80
84
pub fn is_transient ( & self ) -> bool {
81
85
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 ,
85
88
}
86
89
}
87
90
@@ -145,7 +148,7 @@ impl RawVc {
145
148
return Err ( ResolveTypeError :: NoContent ) ;
146
149
}
147
150
}
148
- RawVc :: LocalOutput ( task_id, local_task_id) => {
151
+ RawVc :: LocalOutput ( task_id, _persistence , local_task_id) => {
149
152
current = read_local_output ( & * tt, task_id, local_task_id)
150
153
. await
151
154
. map_err ( |source| ResolveTypeError :: TaskError { source } ) ?;
@@ -182,7 +185,7 @@ impl RawVc {
182
185
consistency = ReadConsistency :: Eventual ;
183
186
}
184
187
RawVc :: TaskCell ( _, _) => return Ok ( current) ,
185
- RawVc :: LocalOutput ( task_id, local_task_id) => {
188
+ RawVc :: LocalOutput ( task_id, _persistence , local_task_id) => {
186
189
debug_assert_eq ! ( consistency, ReadConsistency :: Eventual ) ;
187
190
current = read_local_output ( & * tt, task_id, local_task_id) . await ?;
188
191
}
@@ -197,7 +200,7 @@ impl RawVc {
197
200
let mut current = self ;
198
201
loop {
199
202
match current {
200
- RawVc :: LocalOutput ( task_id, local_task_id) => {
203
+ RawVc :: LocalOutput ( task_id, _persistence , local_task_id) => {
201
204
current = read_local_output ( & * tt, task_id, local_task_id) . await ?;
202
205
}
203
206
non_local => return Ok ( non_local) ,
@@ -212,14 +215,14 @@ impl RawVc {
212
215
213
216
pub fn get_task_id ( & self ) -> TaskId {
214
217
match self {
215
- RawVc :: TaskOutput ( t) | RawVc :: TaskCell ( t, _) | RawVc :: LocalOutput ( t, _ ) => * t,
218
+ RawVc :: TaskOutput ( t) | RawVc :: TaskCell ( t, _) | RawVc :: LocalOutput ( t, .. ) => * t,
216
219
}
217
220
}
218
221
219
222
pub fn try_get_type_id ( & self ) -> Option < ValueTypeId > {
220
223
match self {
221
224
RawVc :: TaskCell ( _, CellId { type_id, .. } ) => Some ( * type_id) ,
222
- RawVc :: TaskOutput ( _) | RawVc :: LocalOutput ( _ , _ ) => None ,
225
+ RawVc :: TaskOutput ( _) | RawVc :: LocalOutput ( .. ) => None ,
223
226
}
224
227
}
225
228
@@ -357,7 +360,7 @@ impl Future for ReadRawVcFuture {
357
360
Err ( err) => return Poll :: Ready ( Err ( err) ) ,
358
361
}
359
362
}
360
- RawVc :: LocalOutput ( task_id, local_output_id) => {
363
+ RawVc :: LocalOutput ( task_id, _persistence , local_output_id) => {
361
364
debug_assert_eq ! ( this. consistency, ReadConsistency :: Eventual ) ;
362
365
let read_result = tt. try_read_local_output ( task_id, local_output_id) ;
363
366
match read_result {
0 commit comments