@@ -478,6 +478,12 @@ pub fn location_info_for_expr(expr: @ast::expr) -> LocationInfo {
478478 id : expr. id
479479 }
480480}
481+ pub fn location_info_for_item( item: @ast:: item) -> LocationInfo {
482+ LocationInfo {
483+ span : item. span,
484+ id : item. id
485+ }
486+ }
481487
482488pub fn early_resolve_expr( ex: @ast:: expr,
483489 fcx: @mut FnCtxt ,
@@ -661,6 +667,27 @@ fn resolve_expr(ex: @ast::expr,
661667 visit:: visit_expr( ex, ( fcx, v) ) ;
662668}
663669
670+ pub fn resolve_impl( ccx: @mut CrateCtxt , impl_item: @ast:: item) {
671+ let def_id = ast_util:: local_def( impl_item. id) ;
672+ match ty:: impl_trait_ref( ccx. tcx, def_id) {
673+ None => { } ,
674+ Some ( trait_ref) => {
675+ let infcx = infer:: new_infer_ctxt( ccx. tcx) ;
676+ let vcx = VtableContext { ccx : ccx, infcx : infcx } ;
677+ let trait_def = ty:: lookup_trait_def( ccx. tcx, trait_ref. def_id) ;
678+
679+ let vtbls = lookup_vtables( & vcx,
680+ & location_info_for_item( impl_item) ,
681+ * trait_def. generics. type_param_defs,
682+ & trait_ref. substs,
683+ false ) ;
684+
685+ // FIXME(#7450): Doesn't work cross crate
686+ ccx. vtable_map. insert( impl_item. id, vtbls) ;
687+ }
688+ }
689+ }
690+
664691// Detect points where a trait-bounded type parameter is
665692// instantiated, resolve the impls for the parameters.
666693pub fn resolve_in_block( fcx: @mut FnCtxt , bl: & ast:: blk) {
0 commit comments