@@ -6,7 +6,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
6
6
use rustc_infer:: infer:: error_reporting:: unexpected_hidden_region_diagnostic;
7
7
use rustc_infer:: infer:: opaque_types:: OpaqueTypeDecl ;
8
8
use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
9
- use rustc_infer:: infer:: { self , InferCtxt , InferOk } ;
9
+ use rustc_infer:: infer:: { InferCtxt , InferOk } ;
10
10
use rustc_middle:: ty:: fold:: { BottomUpFolder , TypeFoldable , TypeFolder , TypeVisitor } ;
11
11
use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind , InternalSubsts , Subst } ;
12
12
use rustc_middle:: ty:: { self , OpaqueTypeKey , Ty , TyCtxt } ;
@@ -295,51 +295,14 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
295
295
hir:: OpaqueTyOrigin :: TyAlias => 0 ,
296
296
} ;
297
297
298
- let span = tcx. def_span ( def_id) ;
299
-
300
- // Check if the `impl Trait` bounds include region bounds.
301
- // For example, this would be true for:
302
- //
303
- // fn foo<'a, 'b, 'c>() -> impl Trait<'c> + 'a + 'b
304
- //
305
- // but false for:
306
- //
307
- // fn foo<'c>() -> impl Trait<'c>
308
- //
309
- // unless `Trait` was declared like:
310
- //
311
- // trait Trait<'c>: 'c
312
- //
313
- // in which case it would be true.
314
- //
315
- // This is used during regionck to decide whether we need to
316
- // impose any additional constraints to ensure that region
317
- // variables in `concrete_ty` wind up being constrained to
318
- // something from `substs` (or, at minimum, things that outlive
319
- // the fn body). (Ultimately, writeback is responsible for this
320
- // check.)
321
- let bounds = tcx. explicit_item_bounds ( def_id) ;
322
- debug ! ( "{:#?}" , bounds) ;
323
- let bounds = bounds. iter ( ) . map ( |( bound, _) | bound. subst ( tcx, opaque_type_key. substs ) ) ;
324
- debug ! ( "{:#?}" , bounds) ;
325
- let opaque_type = tcx. mk_opaque ( def_id, opaque_type_key. substs ) ;
326
-
327
- // (A) The regions that appear in the hidden type must be equal to
298
+ // The regions that appear in the hidden type must be equal to
328
299
// one of the regions in scope for the opaque type.
329
300
self . generate_member_constraint (
330
301
concrete_ty,
331
302
opaque_defn,
332
303
opaque_type_key,
333
304
first_own_region,
334
305
) ;
335
-
336
- // (B) We can also generate outlives bounds that must be enforced.
337
- for required_region in required_region_bounds ( tcx, opaque_type, bounds) {
338
- concrete_ty. visit_with ( & mut ConstrainOpaqueTypeRegionVisitor {
339
- tcx,
340
- op : |r| self . sub_regions ( infer:: CallReturn ( span) , required_region, r) ,
341
- } ) ;
342
- }
343
306
}
344
307
345
308
/// As a fallback, we sometimes generate an "in constraint". For
0 commit comments