@@ -12,11 +12,11 @@ use rustc::hir::def_id::DefId;
1212use rustc:: hir:: intravisit:: { self , NestedVisitorMap , Visitor } ;
1313use rustc:: hir:: map:: definitions:: DefPathData ;
1414use 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 } ;
1617use rustc:: ty:: subst:: Substs ;
1718use rustc:: ty:: { self , Slice , TyCtxt } ;
1819use rustc_data_structures:: fx:: FxHashSet ;
19- use rustc_data_structures:: sync:: Lrc ;
2020use std:: mem;
2121use syntax:: ast;
2222
@@ -122,19 +122,19 @@ impl<'tcx> IntoFromEnvGoal for DomainGoal<'tcx> {
122122crate fn program_clauses_for < ' a , ' tcx > (
123123 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
124124 def_id : DefId ,
125- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
125+ ) -> Clauses < ' tcx > {
126126 match tcx. def_key ( def_id) . disambiguated_data . data {
127127 DefPathData :: Trait ( _) => program_clauses_for_trait ( tcx, def_id) ,
128128 DefPathData :: Impl => program_clauses_for_impl ( tcx, def_id) ,
129129 DefPathData :: AssocTypeInImpl ( ..) => program_clauses_for_associated_type_value ( tcx, def_id) ,
130- _ => Lrc :: new ( Slice :: empty ( ) ) ,
130+ _ => Slice :: empty ( ) ,
131131 }
132132}
133133
134134crate fn program_clauses_for_env < ' a , ' tcx > (
135135 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
136136 param_env : ty:: ParamEnv < ' tcx > ,
137- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
137+ ) -> Clauses < ' tcx > {
138138 debug ! ( "program_clauses_for_env(param_env={:?})" , param_env) ;
139139
140140 let mut last_round = FxHashSet ( ) ;
@@ -164,12 +164,10 @@ crate fn program_clauses_for_env<'a, 'tcx>(
164164
165165 debug ! ( "program_clauses_for_env: closure = {:#?}" , closure) ;
166166
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 ( ) ) ,
173171 ) ;
174172
175173 /// Given that `predicate` is in the environment, returns the
@@ -196,7 +194,7 @@ crate fn program_clauses_for_env<'a, 'tcx>(
196194fn program_clauses_for_trait < ' a , ' tcx > (
197195 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
198196 def_id : DefId ,
199- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
197+ ) -> Clauses < ' tcx > {
200198 // `trait Trait<P1..Pn> where WC { .. } // P0 == Self`
201199
202200 // Rule Implemented-From-Env (see rustc guide)
@@ -243,7 +241,7 @@ fn program_clauses_for_trait<'a, 'tcx>(
243241 . into_iter ( )
244242 . map ( |wc| implied_bound_from_trait ( tcx, trait_pred, wc) ) ;
245243
246- Lrc :: new ( tcx. mk_clauses ( clauses. chain ( implied_bound_clauses) ) )
244+ tcx. mk_clauses ( clauses. chain ( implied_bound_clauses) )
247245}
248246
249247/// 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>(
262260 } ) )
263261}
264262
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 > {
269264 if let ImplPolarity :: Negative = tcx. impl_polarity ( def_id) {
270- return Lrc :: new ( tcx . mk_clauses ( iter :: empty :: < Clause > ( ) ) ) ;
265+ return Slice :: empty ( ) ;
271266 }
272267
273268 // Rule Implemented-From-Impl (see rustc guide)
@@ -295,13 +290,13 @@ fn program_clauses_for_impl<'a, 'tcx>(
295290 . map ( |wc| Goal :: from_poly_domain_goal ( wc, tcx) ) ,
296291 ) ,
297292 } ;
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) ) ) )
299294}
300295
301296pub fn program_clauses_for_associated_type_value < ' a , ' tcx > (
302297 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
303298 item_id : DefId ,
304- ) -> Lrc < & ' tcx Slice < Clause < ' tcx > > > {
299+ ) -> Clauses < ' tcx > {
305300 // Rule Normalize-From-Impl (see rustc guide)
306301 //
307302 // ```impl<P0..Pn> Trait<A1..An> for A0
@@ -349,7 +344,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
349344 . map ( |wc| Goal :: from_poly_domain_goal ( wc, tcx) ) ,
350345 ) ,
351346 } ;
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) ) ) )
353348}
354349
355350pub fn dump_program_clauses < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ) {
0 commit comments