@@ -118,16 +118,15 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
118
118
119
119
/// The point where linking happens. Resolve a (def_id, substs)
120
120
/// 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) ;
124
123
let result = if let Some ( trait_def_id) = tcx. trait_of_item ( def_id) {
125
124
debug ! ( " => associated item, attempting to find impl" ) ;
126
125
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)
128
127
} else {
129
128
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) ;
131
130
132
131
let def = match item_type. sty {
133
132
ty:: TyFnDef ( ..) if {
@@ -141,7 +140,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
141
140
}
142
141
_ => {
143
142
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 ) ;
145
144
if ty. needs_drop ( tcx, ty:: ParamEnv :: empty ( traits:: Reveal :: All ) ) {
146
145
debug ! ( " => nontrivial drop glue" ) ;
147
146
ty:: InstanceDef :: DropGlue ( def_id, Some ( ty) )
@@ -157,10 +156,10 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
157
156
} ;
158
157
Some ( Instance {
159
158
def : def,
160
- substs : self . substs
159
+ substs : substs
161
160
} )
162
161
} ;
163
- debug ! ( "resolve(def_id={:?}, substs={:?}) = {:?}" , def_id, self . substs, result) ;
162
+ debug ! ( "resolve(def_id={:?}, substs={:?}) = {:?}" , def_id, substs, result) ;
164
163
result
165
164
}
166
165
0 commit comments