@@ -85,6 +85,8 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
85
85
source_substs : & ' tcx Substs < ' tcx > ,
86
86
target_node : specialization_graph:: Node )
87
87
-> & ' tcx Substs < ' tcx > {
88
+ debug ! ( "translate_substs({:?}, {:?}, {:?}, {:?})" ,
89
+ param_env, source_impl, source_substs, target_node) ;
88
90
let source_trait_ref = infcx. tcx
89
91
. impl_trait_ref ( source_impl)
90
92
. unwrap ( )
@@ -119,10 +121,13 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
119
121
/// whichever applies.
120
122
pub fn find_associated_item < ' a , ' tcx > (
121
123
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
124
+ param_env : ty:: ParamEnv < ' tcx > ,
122
125
item : & ty:: AssociatedItem ,
123
126
substs : & ' tcx Substs < ' tcx > ,
124
127
impl_data : & super :: VtableImplData < ' tcx , ( ) > ,
125
128
) -> ( DefId , & ' tcx Substs < ' tcx > ) {
129
+ debug ! ( "find_associated_item({:?}, {:?}, {:?}, {:?})" ,
130
+ param_env, item, substs, impl_data) ;
126
131
assert ! ( !substs. needs_infer( ) ) ;
127
132
128
133
let trait_def_id = tcx. trait_id_of_impl ( impl_data. impl_def_id ) . unwrap ( ) ;
@@ -132,7 +137,7 @@ pub fn find_associated_item<'a, 'tcx>(
132
137
match ancestors. defs ( tcx, item. ident , item. kind , trait_def_id) . next ( ) {
133
138
Some ( node_item) => {
134
139
let substs = tcx. infer_ctxt ( ) . enter ( |infcx| {
135
- let param_env = ty :: ParamEnv :: reveal_all ( ) ;
140
+ let param_env = param_env . with_reveal_all ( ) ;
136
141
let substs = substs. rebase_onto ( tcx, trait_def_id, impl_data. substs ) ;
137
142
let substs = translate_substs ( & infcx, param_env, impl_data. impl_def_id ,
138
143
substs, node_item. node ) ;
@@ -219,12 +224,17 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
219
224
source_trait_ref : ty:: TraitRef < ' tcx > ,
220
225
target_impl : DefId )
221
226
-> Result < & ' tcx Substs < ' tcx > , ( ) > {
227
+ debug ! ( "fulfill_implication({:?}, trait_ref={:?} |- {:?} applies)" ,
228
+ param_env, source_trait_ref, target_impl) ;
229
+
222
230
let selcx = & mut SelectionContext :: new ( & infcx) ;
223
231
let target_substs = infcx. fresh_substs_for_item ( DUMMY_SP , target_impl) ;
224
232
let ( target_trait_ref, mut obligations) = impl_trait_ref_and_oblig ( selcx,
225
233
param_env,
226
234
target_impl,
227
235
target_substs) ;
236
+ debug ! ( "fulfill_implication: target_trait_ref={:?}, obligations={:?}" ,
237
+ target_trait_ref, obligations) ;
228
238
229
239
// do the impls unify? If not, no specialization.
230
240
match infcx. at ( & ObligationCause :: dummy ( ) , param_env)
0 commit comments