Convert return type of get_vtable_methods to Vec

This commit is contained in:
Jimmy Brisson 2017-10-07 09:20:13 -05:00
parent d21c023964
commit 4e116e1426
3 changed files with 4 additions and 4 deletions

View File

@ -653,7 +653,7 @@ pub fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub fn get_vtable_methods<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>)
-> impl Iterator<Item=Option<(DefId, &'tcx Substs<'tcx>)>> + 'a
-> Vec<Option<(DefId, &'tcx Substs<'tcx>)>>
{
debug!("get_vtable_methods({:?})", trait_ref);
@ -696,7 +696,7 @@ pub fn get_vtable_methods<'a, 'tcx>(
Some((def_id, substs))
})
})
}).collect()
}
impl<'tcx,O> Obligation<'tcx,O> {

View File

@ -850,7 +850,7 @@ fn create_trans_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// Walk all methods of the trait, including those of its supertraits
let methods = traits::get_vtable_methods(tcx, poly_trait_ref);
let methods = methods.filter_map(|method| method)
let methods = methods.into_iter().filter_map(|method| method)
.map(|(def_id, substs)| ty::Instance::resolve(
tcx,
ty::ParamEnv::empty(traits::Reveal::All),

View File

@ -87,7 +87,7 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
if let Some(trait_ref) = trait_ref {
let trait_ref = trait_ref.with_self_ty(tcx, ty);
let methods = traits::get_vtable_methods(tcx, trait_ref).map(|opt_mth| {
let methods = traits::get_vtable_methods(tcx, trait_ref).into_iter().map(|opt_mth| {
opt_mth.map_or(nullptr, |(def_id, substs)| {
callee::resolve_and_get_fn(ccx, def_id, substs)
})