@@ -16,7 +16,8 @@ use crate::traits::{
16
16
} ;
17
17
use rustc_data_structures:: fx:: FxIndexSet ;
18
18
use rustc_errors:: Diagnostic ;
19
- use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
19
+ use rustc_hir:: def_id:: { DefId , CRATE_DEF_ID , LOCAL_CRATE } ;
20
+ use rustc_hir:: CRATE_HIR_ID ;
20
21
use rustc_infer:: infer:: { InferCtxt , TyCtxtInferExt } ;
21
22
use rustc_infer:: traits:: util;
22
23
use rustc_middle:: traits:: specialization_graph:: OverlapMode ;
@@ -395,19 +396,20 @@ fn resolve_negative_obligation<'cx, 'tcx>(
395
396
return false ;
396
397
}
397
398
398
- let outlives_env = if let Some ( body_def_id) = body_def_id. as_local ( ) {
399
- let body_id = tcx. hir ( ) . local_def_id_to_hir_id ( body_def_id) ;
400
- let ocx = ObligationCtxt :: new ( & infcx) ;
401
- let wf_tys = ocx. assumed_wf_types ( param_env, DUMMY_SP , body_def_id) ;
402
- OutlivesEnvironment :: with_bounds (
403
- param_env,
404
- Some ( & infcx) ,
405
- infcx. implied_bounds_tys ( param_env, body_id, wf_tys) ,
406
- )
399
+ let ( body_id, body_def_id) = if let Some ( body_def_id) = body_def_id. as_local ( ) {
400
+ ( tcx. hir ( ) . local_def_id_to_hir_id ( body_def_id) , body_def_id)
407
401
} else {
408
- OutlivesEnvironment :: new ( param_env )
402
+ ( CRATE_HIR_ID , CRATE_DEF_ID )
409
403
} ;
410
404
405
+ let ocx = ObligationCtxt :: new ( & infcx) ;
406
+ let wf_tys = ocx. assumed_wf_types ( param_env, DUMMY_SP , body_def_id) ;
407
+ let outlives_env = OutlivesEnvironment :: with_bounds (
408
+ param_env,
409
+ Some ( & infcx) ,
410
+ infcx. implied_bounds_tys ( param_env, body_id, wf_tys) ,
411
+ ) ;
412
+
411
413
infcx. process_registered_region_obligations ( outlives_env. region_bound_pairs ( ) , param_env) ;
412
414
413
415
infcx. resolve_regions ( & outlives_env) . is_empty ( )
0 commit comments