@@ -118,16 +118,15 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
118118
119119 /// The point where linking happens. Resolve a (def_id, substs)
120120 /// pair to an instance.
121- pub fn resolve ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > ) -> Option < Instance < ' tcx > > {
122- let def_id = self . def_id ( ) ;
123- debug ! ( "resolve(def_id={:?}, substs={:?})" , def_id, self . substs) ;
121+ pub fn resolve ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId , substs : & ' tcx Substs < ' tcx > ) -> Option < Instance < ' tcx > > {
122+ debug ! ( "resolve(def_id={:?}, substs={:?})" , def_id, substs) ;
124123 let result = if let Some ( trait_def_id) = tcx. trait_of_item ( def_id) {
125124 debug ! ( " => associated item, attempting to find impl" ) ;
126125 let item = tcx. associated_item ( def_id) ;
127- resolve_associated_item ( tcx, & item, trait_def_id, self . substs )
126+ resolve_associated_item ( tcx, & item, trait_def_id, substs)
128127 } else {
129128 let ty = tcx. type_of ( def_id) ;
130- let item_type = tcx. trans_apply_param_substs ( self . substs , & ty) ;
129+ let item_type = tcx. trans_apply_param_substs ( substs, & ty) ;
131130
132131 let def = match item_type. sty {
133132 ty:: TyFnDef ( ..) if {
@@ -141,7 +140,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
141140 }
142141 _ => {
143142 if Some ( def_id) == tcx. lang_items ( ) . drop_in_place_fn ( ) {
144- let ty = self . substs . type_at ( 0 ) ;
143+ let ty = substs. type_at ( 0 ) ;
145144 if ty. needs_drop ( tcx, ty:: ParamEnv :: empty ( traits:: Reveal :: All ) ) {
146145 debug ! ( " => nontrivial drop glue" ) ;
147146 ty:: InstanceDef :: DropGlue ( def_id, Some ( ty) )
@@ -157,10 +156,10 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
157156 } ;
158157 Some ( Instance {
159158 def : def,
160- substs : self . substs
159+ substs : substs
161160 } )
162161 } ;
163- debug ! ( "resolve(def_id={:?}, substs={:?}) = {:?}" , def_id, self . substs, result) ;
162+ debug ! ( "resolve(def_id={:?}, substs={:?}) = {:?}" , def_id, substs, result) ;
164163 result
165164 }
166165
0 commit comments