@@ -6,7 +6,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
66use rustc_infer:: infer:: error_reporting:: unexpected_hidden_region_diagnostic;
77use rustc_infer:: infer:: opaque_types:: OpaqueTypeDecl ;
88use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
9- use rustc_infer:: infer:: { self , InferCtxt , InferOk } ;
9+ use rustc_infer:: infer:: { InferCtxt , InferOk } ;
1010use rustc_middle:: ty:: fold:: { BottomUpFolder , TypeFoldable , TypeFolder , TypeVisitor } ;
1111use rustc_middle:: ty:: subst:: { GenericArg , GenericArgKind , InternalSubsts , Subst } ;
1212use rustc_middle:: ty:: { self , OpaqueTypeKey , Ty , TyCtxt } ;
@@ -295,51 +295,14 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
295295 hir:: OpaqueTyOrigin :: TyAlias => 0 ,
296296 } ;
297297
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
328299 // one of the regions in scope for the opaque type.
329300 self . generate_member_constraint (
330301 concrete_ty,
331302 opaque_defn,
332303 opaque_type_key,
333304 first_own_region,
334305 ) ;
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- }
343306 }
344307
345308 /// As a fallback, we sometimes generate an "in constraint". For
0 commit comments