@@ -19,6 +19,7 @@ use rustc_middle::ty::{self, TyCtxt};
19
19
/// obligations *could be* resolved if we wanted to.
20
20
///
21
21
/// This also expects that `trait_ref` is fully normalized.
22
+ #[ instrument( level = "debug" , skip( tcx) ) ]
22
23
pub fn codegen_fulfill_obligation < ' tcx > (
23
24
tcx : TyCtxt < ' tcx > ,
24
25
( param_env, trait_ref) : ( ty:: ParamEnv < ' tcx > , ty:: PolyTraitRef < ' tcx > ) ,
@@ -27,11 +28,6 @@ pub fn codegen_fulfill_obligation<'tcx>(
27
28
let trait_ref = tcx. erase_regions ( trait_ref) ;
28
29
// We expect the input to be fully normalized.
29
30
debug_assert_eq ! ( trait_ref, tcx. normalize_erasing_regions( param_env, trait_ref) ) ;
30
- debug ! (
31
- "codegen_fulfill_obligation(trait_ref={:?}, def_id={:?})" ,
32
- ( param_env, trait_ref) ,
33
- trait_ref. def_id( )
34
- ) ;
35
31
36
32
// Do the initial selection for the obligation. This yields the
37
33
// shallow result we are looking for -- that is, what specific impl.
@@ -80,25 +76,22 @@ pub fn codegen_fulfill_obligation<'tcx>(
80
76
}
81
77
} ;
82
78
83
- debug ! ( "fulfill_obligation: selection={:?}" , selection) ;
79
+ debug ! ( ? selection) ;
84
80
85
81
// Currently, we use a fulfillment context to completely resolve
86
82
// all nested obligations. This is because they can inform the
87
83
// inference of the impl's type parameters.
88
84
let mut fulfill_cx = FulfillmentContext :: new ( ) ;
89
85
let impl_source = selection. map ( |predicate| {
90
- debug ! ( "fulfill_obligation: register_predicate_obligation {:?}" , predicate) ;
91
86
fulfill_cx. register_predicate_obligation ( & infcx, predicate) ;
92
87
} ) ;
93
88
let impl_source = drain_fulfillment_cx_or_panic ( & infcx, & mut fulfill_cx, impl_source) ;
94
89
95
- // There should be no opaque types during codegen, they all get revealed.
96
- let opaque_types = infcx. inner . borrow_mut ( ) . opaque_type_storage . take_opaque_types ( ) ;
97
- if !opaque_types. is_empty ( ) {
98
- bug ! ( "{:#?}" , opaque_types) ;
99
- }
90
+ // Opaque types may have gotten their hidden types constrained, but we can ignore them safely
91
+ // as they will get constrained elsewhere, too.
92
+ let _opaque_types = infcx. inner . borrow_mut ( ) . opaque_type_storage . take_opaque_types ( ) ;
100
93
101
- debug ! ( "Cache miss: {:?} => {:?}" , trait_ref , impl_source ) ;
94
+ debug ! ( "Cache miss: {trait_ref :?} => {impl_source :?}" ) ;
102
95
Ok ( & * tcx. arena . alloc ( impl_source) )
103
96
} )
104
97
}
0 commit comments