@@ -2153,10 +2153,12 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
21532153 match ty:: impl_or_trait_item ( cx, method_def_id) {
21542154 MethodTraitItem ( ref method_ty) => {
21552155 let method_generics = & method_ty. generics ;
2156+ let method_bounds = & method_ty. predicates ;
21562157 construct_parameter_environment (
21572158 cx,
21582159 method. span ,
21592160 method_generics,
2161+ method_bounds,
21602162 method. pe_body ( ) . id )
21612163 }
21622164 TypeTraitItem ( _) => {
@@ -2188,10 +2190,12 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
21882190 match ty:: impl_or_trait_item ( cx, method_def_id) {
21892191 MethodTraitItem ( ref method_ty) => {
21902192 let method_generics = & method_ty. generics ;
2193+ let method_bounds = & method_ty. predicates ;
21912194 construct_parameter_environment (
21922195 cx,
21932196 method. span ,
21942197 method_generics,
2198+ method_bounds,
21952199 method. pe_body ( ) . id )
21962200 }
21972201 TypeTraitItem ( _) => {
@@ -2214,11 +2218,13 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
22142218 ast:: ItemFn ( _, _, _, _, ref body) => {
22152219 // We assume this is a function.
22162220 let fn_def_id = ast_util:: local_def ( id) ;
2217- let fn_pty = ty:: lookup_item_type ( cx, fn_def_id) ;
2221+ let fn_scheme = lookup_item_type ( cx, fn_def_id) ;
2222+ let fn_predicates = lookup_predicates ( cx, fn_def_id) ;
22182223
22192224 construct_parameter_environment ( cx,
22202225 item. span ,
2221- & fn_pty. generics ,
2226+ & fn_scheme. generics ,
2227+ & fn_predicates,
22222228 body. id )
22232229 }
22242230 ast:: ItemEnum ( ..) |
@@ -2227,8 +2233,13 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
22272233 ast:: ItemConst ( ..) |
22282234 ast:: ItemStatic ( ..) => {
22292235 let def_id = ast_util:: local_def ( id) ;
2230- let pty = ty:: lookup_item_type ( cx, def_id) ;
2231- construct_parameter_environment ( cx, item. span , & pty. generics , id)
2236+ let scheme = lookup_item_type ( cx, def_id) ;
2237+ let predicates = lookup_predicates ( cx, def_id) ;
2238+ construct_parameter_environment ( cx,
2239+ item. span ,
2240+ & scheme. generics ,
2241+ & predicates,
2242+ id)
22322243 }
22332244 _ => {
22342245 cx. sess . span_bug ( item. span ,
@@ -6320,7 +6331,7 @@ pub fn empty_parameter_environment<'a,'tcx>(cx: &'a ctxt<'tcx>) -> ParameterEnvi
63206331/// parameters in the same way, this only has an effect on regions.
63216332pub fn construct_free_substs < ' a , ' tcx > (
63226333 tcx : & ' a ctxt < ' tcx > ,
6323- generics : & ty :: Generics < ' tcx > ,
6334+ generics : & Generics < ' tcx > ,
63246335 free_id : ast:: NodeId )
63256336 -> Substs < ' tcx >
63266337{
@@ -6365,6 +6376,7 @@ pub fn construct_parameter_environment<'a,'tcx>(
63656376 tcx : & ' a ctxt < ' tcx > ,
63666377 span : Span ,
63676378 generics : & ty:: Generics < ' tcx > ,
6379+ generic_predicates : & ty:: GenericPredicates < ' tcx > ,
63686380 free_id : ast:: NodeId )
63696381 -> ParameterEnvironment < ' a , ' tcx >
63706382{
@@ -6379,7 +6391,7 @@ pub fn construct_parameter_environment<'a,'tcx>(
63796391 // Compute the bounds on Self and the type parameters.
63806392 //
63816393
6382- let bounds = generics . to_bounds ( tcx, & free_substs) ;
6394+ let bounds = generic_predicates . instantiate ( tcx, & free_substs) ;
63836395 let bounds = liberate_late_bound_regions ( tcx, free_id_outlive, & ty:: Binder ( bounds) ) ;
63846396 let predicates = bounds. predicates . into_vec ( ) ;
63856397
@@ -7013,8 +7025,7 @@ impl<'tcx,T:RegionEscape> RegionEscape for VecPerParamSpace<T> {
70137025
70147026impl < ' tcx > RegionEscape for TypeScheme < ' tcx > {
70157027 fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
7016- self . ty . has_regions_escaping_depth ( depth) ||
7017- self . generics . has_regions_escaping_depth ( depth)
7028+ self . ty . has_regions_escaping_depth ( depth)
70187029 }
70197030}
70207031
@@ -7024,7 +7035,7 @@ impl RegionEscape for Region {
70247035 }
70257036}
70267037
7027- impl < ' tcx > RegionEscape for Generics < ' tcx > {
7038+ impl < ' tcx > RegionEscape for GenericPredicates < ' tcx > {
70287039 fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
70297040 self . predicates . has_regions_escaping_depth ( depth)
70307041 }
@@ -7133,7 +7144,7 @@ impl<'tcx> HasProjectionTypes for ClosureUpvar<'tcx> {
71337144 }
71347145}
71357146
7136- impl < ' tcx > HasProjectionTypes for ty:: GenericBounds < ' tcx > {
7147+ impl < ' tcx > HasProjectionTypes for ty:: InstantiatedPredicates < ' tcx > {
71377148 fn has_projection_types ( & self ) -> bool {
71387149 self . predicates . has_projection_types ( )
71397150 }
0 commit comments