+
+/// Return the substituted type of an instance.
+pub fn instance_ty<'a, 'tcx>(shared: &SharedCrateContext<'a, 'tcx>,
+ instance: &ty::Instance<'tcx>)
+ -> Ty<'tcx>
+{
+ let ty = instance.def.def_ty(shared.tcx());
+ monomorphize::apply_param_substs(shared, instance.substs, &ty)
+}
+
+pub fn find_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+ name: ast::Name,
+ substs: &'tcx Substs<'tcx>,
+ impl_data: &traits::VtableImplData<'tcx, ()>)
+ -> ty::Instance<'tcx>
+{
+ let (def_id, substs) = traits::find_method(tcx, name, substs, impl_data);
+ let substs = tcx.erase_regions(&substs);
+ ty::Instance::new(def_id, substs)
+}