@@ -12,11 +12,11 @@ use rustc::hir::def_id::DefId;
12
12
use rustc:: hir:: intravisit:: { self , NestedVisitorMap , Visitor } ;
13
13
use rustc:: hir:: map:: definitions:: DefPathData ;
14
14
use rustc:: hir:: { self , ImplPolarity } ;
15
- use rustc:: traits:: { Clause , DomainGoal , Goal , PolyDomainGoal , ProgramClause , WhereClauseAtom } ;
15
+ use rustc:: traits:: { Clause , Clauses , DomainGoal , Goal , PolyDomainGoal , ProgramClause ,
16
+ WhereClauseAtom } ;
16
17
use rustc:: ty:: subst:: Substs ;
17
18
use rustc:: ty:: { self , Slice , TyCtxt } ;
18
19
use rustc_data_structures:: fx:: FxHashSet ;
19
- use rustc_data_structures:: sync:: Lrc ;
20
20
use std:: mem;
21
21
use syntax:: ast;
22
22
@@ -122,19 +122,19 @@ impl<'tcx> IntoFromEnvGoal for DomainGoal<'tcx> {
122
122
crate fn program_clauses_for < ' a , ' tcx > (
123
123
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
124
124
def_id : DefId ,
125
- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
125
+ ) -> Clauses < ' tcx > {
126
126
match tcx. def_key ( def_id) . disambiguated_data . data {
127
127
DefPathData :: Trait ( _) => program_clauses_for_trait ( tcx, def_id) ,
128
128
DefPathData :: Impl => program_clauses_for_impl ( tcx, def_id) ,
129
129
DefPathData :: AssocTypeInImpl ( ..) => program_clauses_for_associated_type_value ( tcx, def_id) ,
130
- _ => Lrc :: new ( Slice :: empty ( ) ) ,
130
+ _ => Slice :: empty ( ) ,
131
131
}
132
132
}
133
133
134
134
crate fn program_clauses_for_env < ' a , ' tcx > (
135
135
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
136
136
param_env : ty:: ParamEnv < ' tcx > ,
137
- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
137
+ ) -> Clauses < ' tcx > {
138
138
debug ! ( "program_clauses_for_env(param_env={:?})" , param_env) ;
139
139
140
140
let mut last_round = FxHashSet ( ) ;
@@ -164,12 +164,10 @@ crate fn program_clauses_for_env<'a, 'tcx>(
164
164
165
165
debug ! ( "program_clauses_for_env: closure = {:#?}" , closure) ;
166
166
167
- return Lrc :: new (
168
- tcx. mk_clauses (
169
- closure
170
- . into_iter ( )
171
- . flat_map ( |def_id| tcx. program_clauses_for ( def_id) . iter ( ) . cloned ( ) ) ,
172
- ) ,
167
+ return tcx. mk_clauses (
168
+ closure
169
+ . into_iter ( )
170
+ . flat_map ( |def_id| tcx. program_clauses_for ( def_id) . iter ( ) . cloned ( ) ) ,
173
171
) ;
174
172
175
173
/// Given that `predicate` is in the environment, returns the
@@ -196,7 +194,7 @@ crate fn program_clauses_for_env<'a, 'tcx>(
196
194
fn program_clauses_for_trait < ' a , ' tcx > (
197
195
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
198
196
def_id : DefId ,
199
- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
197
+ ) -> Clauses < ' tcx > {
200
198
// `trait Trait<P1..Pn> where WC { .. } // P0 == Self`
201
199
202
200
// Rule Implemented-From-Env (see rustc guide)
@@ -243,7 +241,7 @@ fn program_clauses_for_trait<'a, 'tcx>(
243
241
. into_iter ( )
244
242
. map ( |wc| implied_bound_from_trait ( tcx, trait_pred, wc) ) ;
245
243
246
- Lrc :: new ( tcx. mk_clauses ( clauses. chain ( implied_bound_clauses) ) )
244
+ tcx. mk_clauses ( clauses. chain ( implied_bound_clauses) )
247
245
}
248
246
249
247
/// For a given `where_clause`, returns a clause `FromEnv(WC) :- FromEnv(Self: Trait<P1..Pn>)`.
@@ -262,12 +260,9 @@ fn implied_bound_from_trait<'a, 'tcx>(
262
260
} ) )
263
261
}
264
262
265
- fn program_clauses_for_impl < ' a , ' tcx > (
266
- tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
267
- def_id : DefId ,
268
- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
263
+ fn program_clauses_for_impl < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId ) -> Clauses < ' tcx > {
269
264
if let ImplPolarity :: Negative = tcx. impl_polarity ( def_id) {
270
- return Lrc :: new ( tcx . mk_clauses ( iter :: empty :: < Clause > ( ) ) ) ;
265
+ return Slice :: empty ( ) ;
271
266
}
272
267
273
268
// Rule Implemented-From-Impl (see rustc guide)
@@ -295,13 +290,13 @@ fn program_clauses_for_impl<'a, 'tcx>(
295
290
. map ( |wc| Goal :: from_poly_domain_goal ( wc, tcx) ) ,
296
291
) ,
297
292
} ;
298
- Lrc :: new ( tcx. mk_clauses ( iter:: once ( Clause :: ForAll ( ty:: Binder :: dummy ( clause) ) ) ) )
293
+ tcx. mk_clauses ( iter:: once ( Clause :: ForAll ( ty:: Binder :: dummy ( clause) ) ) )
299
294
}
300
295
301
296
pub fn program_clauses_for_associated_type_value < ' a , ' tcx > (
302
297
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
303
298
item_id : DefId ,
304
- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
299
+ ) -> Clauses < ' tcx > {
305
300
// Rule Normalize-From-Impl (see rustc guide)
306
301
//
307
302
// ```impl<P0..Pn> Trait<A1..An> for A0
@@ -349,7 +344,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
349
344
. map ( |wc| Goal :: from_poly_domain_goal ( wc, tcx) ) ,
350
345
) ,
351
346
} ;
352
- Lrc :: new ( tcx. mk_clauses ( iter:: once ( Clause :: ForAll ( ty:: Binder :: dummy ( clause) ) ) ) )
347
+ tcx. mk_clauses ( iter:: once ( Clause :: ForAll ( ty:: Binder :: dummy ( clause) ) ) )
353
348
}
354
349
355
350
pub fn dump_program_clauses < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) {
0 commit comments