1
1
use std:: { collections:: VecDeque , marker:: PhantomData } ;
2
2
3
- use rustc_index:: { bit_set :: BitSet , vec:: Idx } ;
3
+ use rustc_index:: vec:: Idx ;
4
4
5
5
#[ derive( Copy , Clone , Debug ) ]
6
6
enum Undo < T > {
@@ -12,18 +12,12 @@ enum Undo<T> {
12
12
pub struct ModifiedSet < T : Idx > {
13
13
modified : VecDeque < Undo < T > > ,
14
14
snapshots : usize ,
15
- modified_set : BitSet < T > ,
16
15
offsets : Vec < usize > ,
17
16
}
18
17
19
18
impl < T : Idx > Default for ModifiedSet < T > {
20
19
fn default ( ) -> Self {
21
- Self {
22
- modified : Default :: default ( ) ,
23
- snapshots : 0 ,
24
- modified_set : BitSet :: new_empty ( 0 ) ,
25
- offsets : Vec :: new ( ) ,
26
- }
20
+ Self { modified : Default :: default ( ) , snapshots : 0 , offsets : Vec :: new ( ) }
27
21
}
28
22
}
29
23
@@ -33,12 +27,7 @@ impl<T: Idx> ModifiedSet<T> {
33
27
}
34
28
35
29
pub fn set ( & mut self , index : T ) {
36
- if index. index ( ) >= self . modified_set . domain_size ( ) {
37
- self . modified_set . resize ( index. index ( ) + 1 ) ;
38
- }
39
- if self . modified_set . insert ( index) {
40
- self . modified . push_back ( Undo :: Add ( index) ) ;
41
- }
30
+ self . modified . push_back ( Undo :: Add ( index) ) ;
42
31
}
43
32
44
33
pub fn drain ( & mut self , index : & Offset < T > , mut f : impl FnMut ( T ) -> bool ) {
@@ -66,9 +55,7 @@ impl<T: Idx> ModifiedSet<T> {
66
55
self . modified . iter ( ) . rev ( ) . take ( self . modified . len ( ) - snapshot. modified_len )
67
56
{
68
57
match undo {
69
- Undo :: Add ( index) => {
70
- self . modified_set . remove ( index) ;
71
- }
58
+ Undo :: Add ( _) => { }
72
59
Undo :: Drain { index, offset } => {
73
60
if let Some ( o) = self . offsets . get_mut ( index) {
74
61
* o = offset;
0 commit comments