@@ -3,7 +3,7 @@ use std::collections::HashSet;
3
3
use std:: fmt:: { Debug , Formatter } ;
4
4
use std:: hash:: Hash ;
5
5
use std:: marker:: PhantomData ;
6
- use std:: sync :: Arc ;
6
+ use std:: rc :: Rc ;
7
7
8
8
use super :: { Scope , ScopeGraph } ;
9
9
@@ -54,7 +54,7 @@ enum InnerPath<LABEL> {
54
54
/// Path (alternating sequence of scopes and labels) in a scope graph.
55
55
#[ derive( Clone ) ]
56
56
pub struct Path < LABEL > {
57
- inner_path : Arc < InnerPath < LABEL > > ,
57
+ inner_path : Rc < InnerPath < LABEL > > ,
58
58
/// Set of all scopes in this path.
59
59
///
60
60
/// Paths are alternating sequences of scopes and labels.
@@ -64,7 +64,7 @@ pub struct Path<LABEL> {
64
64
/// This is cheaper than traversing the [`Path::inner_path`], at the cost of some more memory usage.
65
65
///
66
66
/// In order to make paths cheap to extend multiple times, we use a persistent data structure.
67
- scopes : Arc < TrieSet < Scope > > ,
67
+ scopes : Rc < TrieSet < Scope > > ,
68
68
// FIXME: put fields in same Arc
69
69
}
70
70
@@ -139,8 +139,8 @@ impl<LABEL> Path<LABEL> {
139
139
/// Creates a new path that contains of a single scope.
140
140
pub fn new ( source : Scope ) -> Self {
141
141
Self {
142
- inner_path : Arc :: new ( InnerPath :: Start { source } ) ,
143
- scopes : Arc :: new ( TrieSet :: new ( ) . insert ( source) ) ,
142
+ inner_path : Rc :: new ( InnerPath :: Start { source } ) ,
143
+ scopes : Rc :: new ( TrieSet :: new ( ) . insert ( source) ) ,
144
144
}
145
145
}
146
146
@@ -160,15 +160,15 @@ impl<LABEL> Path<LABEL> {
160
160
None
161
161
} else {
162
162
Some ( Self {
163
- inner_path : Arc :: new ( InnerPath :: Step {
163
+ inner_path : Rc :: new ( InnerPath :: Step {
164
164
prefix : Self {
165
165
inner_path : self . inner_path . clone ( ) ,
166
166
scopes : self . scopes . clone ( ) ,
167
167
} ,
168
168
label,
169
169
target,
170
170
} ) ,
171
- scopes : Arc :: new ( self . scopes . insert ( target) ) ,
171
+ scopes : Rc :: new ( self . scopes . insert ( target) ) ,
172
172
} )
173
173
}
174
174
}
0 commit comments