@@ -2153,10 +2153,12 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
2153
2153
match ty:: impl_or_trait_item ( cx, method_def_id) {
2154
2154
MethodTraitItem ( ref method_ty) => {
2155
2155
let method_generics = & method_ty. generics ;
2156
+ let method_bounds = & method_ty. predicates ;
2156
2157
construct_parameter_environment (
2157
2158
cx,
2158
2159
method. span ,
2159
2160
method_generics,
2161
+ method_bounds,
2160
2162
method. pe_body ( ) . id )
2161
2163
}
2162
2164
TypeTraitItem ( _) => {
@@ -2188,10 +2190,12 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
2188
2190
match ty:: impl_or_trait_item ( cx, method_def_id) {
2189
2191
MethodTraitItem ( ref method_ty) => {
2190
2192
let method_generics = & method_ty. generics ;
2193
+ let method_bounds = & method_ty. predicates ;
2191
2194
construct_parameter_environment (
2192
2195
cx,
2193
2196
method. span ,
2194
2197
method_generics,
2198
+ method_bounds,
2195
2199
method. pe_body ( ) . id )
2196
2200
}
2197
2201
TypeTraitItem ( _) => {
@@ -2214,11 +2218,13 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
2214
2218
ast:: ItemFn ( _, _, _, _, ref body) => {
2215
2219
// We assume this is a function.
2216
2220
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) ;
2218
2223
2219
2224
construct_parameter_environment ( cx,
2220
2225
item. span ,
2221
- & fn_pty. generics ,
2226
+ & fn_scheme. generics ,
2227
+ & fn_predicates,
2222
2228
body. id )
2223
2229
}
2224
2230
ast:: ItemEnum ( ..) |
@@ -2227,8 +2233,13 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
2227
2233
ast:: ItemConst ( ..) |
2228
2234
ast:: ItemStatic ( ..) => {
2229
2235
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)
2232
2243
}
2233
2244
_ => {
2234
2245
cx. sess . span_bug ( item. span ,
@@ -6320,7 +6331,7 @@ pub fn empty_parameter_environment<'a,'tcx>(cx: &'a ctxt<'tcx>) -> ParameterEnvi
6320
6331
/// parameters in the same way, this only has an effect on regions.
6321
6332
pub fn construct_free_substs < ' a , ' tcx > (
6322
6333
tcx : & ' a ctxt < ' tcx > ,
6323
- generics : & ty :: Generics < ' tcx > ,
6334
+ generics : & Generics < ' tcx > ,
6324
6335
free_id : ast:: NodeId )
6325
6336
-> Substs < ' tcx >
6326
6337
{
@@ -6365,6 +6376,7 @@ pub fn construct_parameter_environment<'a,'tcx>(
6365
6376
tcx : & ' a ctxt < ' tcx > ,
6366
6377
span : Span ,
6367
6378
generics : & ty:: Generics < ' tcx > ,
6379
+ generic_predicates : & ty:: GenericPredicates < ' tcx > ,
6368
6380
free_id : ast:: NodeId )
6369
6381
-> ParameterEnvironment < ' a , ' tcx >
6370
6382
{
@@ -6379,7 +6391,7 @@ pub fn construct_parameter_environment<'a,'tcx>(
6379
6391
// Compute the bounds on Self and the type parameters.
6380
6392
//
6381
6393
6382
- let bounds = generics . to_bounds ( tcx, & free_substs) ;
6394
+ let bounds = generic_predicates . instantiate ( tcx, & free_substs) ;
6383
6395
let bounds = liberate_late_bound_regions ( tcx, free_id_outlive, & ty:: Binder ( bounds) ) ;
6384
6396
let predicates = bounds. predicates . into_vec ( ) ;
6385
6397
@@ -7013,8 +7025,7 @@ impl<'tcx,T:RegionEscape> RegionEscape for VecPerParamSpace<T> {
7013
7025
7014
7026
impl < ' tcx > RegionEscape for TypeScheme < ' tcx > {
7015
7027
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)
7018
7029
}
7019
7030
}
7020
7031
@@ -7024,7 +7035,7 @@ impl RegionEscape for Region {
7024
7035
}
7025
7036
}
7026
7037
7027
- impl < ' tcx > RegionEscape for Generics < ' tcx > {
7038
+ impl < ' tcx > RegionEscape for GenericPredicates < ' tcx > {
7028
7039
fn has_regions_escaping_depth ( & self , depth : u32 ) -> bool {
7029
7040
self . predicates . has_regions_escaping_depth ( depth)
7030
7041
}
@@ -7133,7 +7144,7 @@ impl<'tcx> HasProjectionTypes for ClosureUpvar<'tcx> {
7133
7144
}
7134
7145
}
7135
7146
7136
- impl < ' tcx > HasProjectionTypes for ty:: GenericBounds < ' tcx > {
7147
+ impl < ' tcx > HasProjectionTypes for ty:: InstantiatedPredicates < ' tcx > {
7137
7148
fn has_projection_types ( & self ) -> bool {
7138
7149
self . predicates . has_projection_types ( )
7139
7150
}
0 commit comments