@@ -19,6 +19,7 @@ use rustc_middle::ty::{self, TyCtxt};
1919/// obligations *could be* resolved if we wanted to.
2020///
2121/// This also expects that `trait_ref` is fully normalized.
22+ #[ instrument( level = "debug" , skip( tcx) ) ]
2223pub fn codegen_fulfill_obligation < ' tcx > (
2324 tcx : TyCtxt < ' tcx > ,
2425 ( param_env, trait_ref) : ( ty:: ParamEnv < ' tcx > , ty:: PolyTraitRef < ' tcx > ) ,
@@ -27,11 +28,6 @@ pub fn codegen_fulfill_obligation<'tcx>(
2728 let trait_ref = tcx. erase_regions ( trait_ref) ;
2829 // We expect the input to be fully normalized.
2930 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- ) ;
3531
3632 // Do the initial selection for the obligation. This yields the
3733 // shallow result we are looking for -- that is, what specific impl.
@@ -80,25 +76,22 @@ pub fn codegen_fulfill_obligation<'tcx>(
8076 }
8177 } ;
8278
83- debug ! ( "fulfill_obligation: selection={:?}" , selection) ;
79+ debug ! ( ? selection) ;
8480
8581 // Currently, we use a fulfillment context to completely resolve
8682 // all nested obligations. This is because they can inform the
8783 // inference of the impl's type parameters.
8884 let mut fulfill_cx = FulfillmentContext :: new ( ) ;
8985 let impl_source = selection. map ( |predicate| {
90- debug ! ( "fulfill_obligation: register_predicate_obligation {:?}" , predicate) ;
9186 fulfill_cx. register_predicate_obligation ( & infcx, predicate) ;
9287 } ) ;
9388 let impl_source = drain_fulfillment_cx_or_panic ( & infcx, & mut fulfill_cx, impl_source) ;
9489
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 ( ) ;
10093
101- debug ! ( "Cache miss: {:?} => {:?}" , trait_ref , impl_source ) ;
94+ debug ! ( "Cache miss: {trait_ref :?} => {impl_source :?}" ) ;
10295 Ok ( & * tcx. arena . alloc ( impl_source) )
10396 } )
10497}
0 commit comments