This repository was archived by the owner on Oct 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,10 @@ impl<T> Arena<T> {
188188 self . items . truncate ( 1 ) ;
189189 }
190190
191+ pub ( crate ) fn truncate ( & mut self , new_len : usize ) {
192+ self . items . truncate ( new_len) ;
193+ }
194+
191195 /// Adds a new instance to this arena, returning a stable handle to it.
192196 ///
193197 /// Note that we do not deduplicate instances of `T` in any way. If you add two instances that
Original file line number Diff line number Diff line change @@ -2631,4 +2631,27 @@ impl PartialPaths {
26312631 self . partial_scope_stacks . clear ( ) ;
26322632 self . partial_path_edges . clear ( ) ;
26332633 }
2634+
2635+ pub fn save_checkpoint ( & self ) -> PartialPathsCheckpoint {
2636+ PartialPathsCheckpoint {
2637+ partial_symbol_stacks_len : self . partial_symbol_stacks . len ( ) ,
2638+ partial_scope_stacks_len : self . partial_scope_stacks . len ( ) ,
2639+ partial_path_edges_len : self . partial_path_edges . len ( ) ,
2640+ }
2641+ }
2642+
2643+ pub fn restore_checkpoint ( & mut self , checkpoint : PartialPathsCheckpoint ) {
2644+ self . partial_symbol_stacks
2645+ . truncate ( checkpoint. partial_symbol_stacks_len ) ;
2646+ self . partial_scope_stacks
2647+ . truncate ( checkpoint. partial_scope_stacks_len ) ;
2648+ self . partial_path_edges
2649+ . truncate ( checkpoint. partial_path_edges_len ) ;
2650+ }
2651+ }
2652+
2653+ pub struct PartialPathsCheckpoint {
2654+ partial_symbol_stacks_len : usize ,
2655+ partial_scope_stacks_len : usize ,
2656+ partial_path_edges_len : usize ,
26342657}
You can’t perform that action at this time.
0 commit comments