@@ -6,11 +6,10 @@ use crate::fold::{FallibleTypeFolder, TypeFoldable};
6
6
use crate :: visit:: { TypeVisitable , TypeVisitor } ;
7
7
use crate :: Interner ;
8
8
use rustc_data_structures:: functor:: IdFunctor ;
9
+ use rustc_data_structures:: sync:: Lrc ;
9
10
use rustc_index:: { Idx , IndexVec } ;
10
11
11
12
use std:: ops:: ControlFlow ;
12
- use std:: rc:: Rc ;
13
- use std:: sync:: Arc ;
14
13
15
14
///////////////////////////////////////////////////////////////////////////
16
15
// Atomic structs
@@ -106,25 +105,13 @@ impl<I: Interner, T: TypeVisitable<I>, E: TypeVisitable<I>> TypeVisitable<I> for
106
105
}
107
106
}
108
107
109
- impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Rc < T > {
108
+ impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Lrc < T > {
110
109
fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
111
110
self . try_map_id ( |value| value. try_fold_with ( folder) )
112
111
}
113
112
}
114
113
115
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Rc < T > {
116
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
117
- ( * * self ) . visit_with ( visitor)
118
- }
119
- }
120
-
121
- impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Arc < T > {
122
- fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
123
- self . try_map_id ( |value| value. try_fold_with ( folder) )
124
- }
125
- }
126
-
127
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Arc < T > {
114
+ impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Lrc < T > {
128
115
fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
129
116
( * * self ) . visit_with ( visitor)
130
117
}
@@ -154,19 +141,11 @@ impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Vec<T> {
154
141
}
155
142
}
156
143
157
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for & [ T ] {
158
- fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
159
- self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
160
- }
161
- }
162
-
163
- impl < I : Interner , T : TypeFoldable < I > > TypeFoldable < I > for Box < [ T ] > {
164
- fn try_fold_with < F : FallibleTypeFolder < I > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
165
- self . try_map_id ( |t| t. try_fold_with ( folder) )
166
- }
167
- }
144
+ // `TypeFoldable` isn't impl'd for `&[T]`. It doesn't make sense in the general
145
+ // case, because we can't return a new slice. But note that there are a couple
146
+ // of trivial impls of `TypeFoldable` for specific slice types elsewhere.
168
147
169
- impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for Box < [ T ] > {
148
+ impl < I : Interner , T : TypeVisitable < I > > TypeVisitable < I > for & [ T ] {
170
149
fn visit_with < V : TypeVisitor < I > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
171
150
self . iter ( ) . try_for_each ( |t| t. visit_with ( visitor) )
172
151
}
0 commit comments