1
1
use rustc_data_structures:: fx:: FxIndexMap ;
2
2
use rustc_errors:: ErrorGuaranteed ;
3
+ use rustc_hir:: OpaqueTyOrigin ;
3
4
use rustc_hir:: def_id:: LocalDefId ;
5
+ use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
4
6
use rustc_infer:: infer:: { InferCtxt , NllRegionVariableOrigin , TyCtxtInferExt as _} ;
5
7
use rustc_macros:: extension;
6
8
use rustc_middle:: ty:: fold:: fold_regions;
@@ -10,6 +12,7 @@ use rustc_middle::ty::{
10
12
TypingMode ,
11
13
} ;
12
14
use rustc_span:: Span ;
15
+ use rustc_trait_selection:: regions:: OutlivesEnvironmentBuildExt ;
13
16
use rustc_trait_selection:: traits:: ObligationCtxt ;
14
17
use tracing:: { debug, instrument} ;
15
18
@@ -406,20 +409,16 @@ impl<'tcx> LazyOpaqueTyEnv<'tcx> {
406
409
}
407
410
408
411
fn get_canonical_args ( & self ) -> ty:: GenericArgsRef < ' tcx > {
409
- use rustc_hir as hir;
410
- use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
411
- use rustc_trait_selection:: traits:: outlives_bounds:: InferCtxtExt as _;
412
-
413
412
if let Some ( & canonical_args) = self . canonical_args . get ( ) {
414
413
return canonical_args;
415
414
}
416
415
417
416
let & Self { tcx, def_id, .. } = self ;
418
417
let origin = tcx. local_opaque_ty_origin ( def_id) ;
419
418
let parent = match origin {
420
- hir :: OpaqueTyOrigin :: FnReturn { parent, .. }
421
- | hir :: OpaqueTyOrigin :: AsyncFn { parent, .. }
422
- | hir :: OpaqueTyOrigin :: TyAlias { parent, .. } => parent,
419
+ OpaqueTyOrigin :: FnReturn { parent, .. }
420
+ | OpaqueTyOrigin :: AsyncFn { parent, .. }
421
+ | OpaqueTyOrigin :: TyAlias { parent, .. } => parent,
423
422
} ;
424
423
let param_env = tcx. param_env ( parent) ;
425
424
let args = GenericArgs :: identity_for_item ( tcx, parent) . extend_to (
@@ -439,8 +438,7 @@ impl<'tcx> LazyOpaqueTyEnv<'tcx> {
439
438
tcx. dcx ( ) . span_delayed_bug ( tcx. def_span ( def_id) , "error getting implied bounds" ) ;
440
439
Default :: default ( )
441
440
} ) ;
442
- let implied_bounds = infcx. implied_bounds_tys ( parent, param_env, wf_tys) ;
443
- let outlives_env = OutlivesEnvironment :: with_bounds ( param_env, implied_bounds) ;
441
+ let outlives_env = OutlivesEnvironment :: new ( & infcx, parent, param_env, wf_tys) ;
444
442
445
443
let mut seen = vec ! [ tcx. lifetimes. re_static] ;
446
444
let canonical_args = fold_regions ( tcx, args, |r1, _| {
0 commit comments