From 304a5f07867cff4cb6a558d320efafd7c6da56c3 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Fri, 19 Jul 2013 17:19:04 -0700 Subject: [PATCH] Have vtable resolution check for supertrait bounds. Closes #4055. --- src/librustc/middle/typeck/check/vtable.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 9143563a68f..6ab6af2baee 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -727,6 +727,23 @@ pub fn resolve_impl(ccx: @mut CrateCtxt, impl_item: @ast::item) { // FIXME(#7450): Doesn't work cross crate ccx.vtable_map.insert(impl_item.id, vtbls); + + // Now, locate the vtable for the impl itself. The real + // purpose of this is to check for supertrait impls, + // but that falls out of doing this. + let param_bounds = ty::ParamBounds { + builtin_bounds: ty::EmptyBuiltinBounds(), + trait_bounds: ~[trait_ref] + }; + let t = ty::node_id_to_type(ccx.tcx, impl_item.id); + debug!("=== Doing a self lookup now."); + // Right now, we don't have any place to store this. + // We will need to make one so we can use this information + // for compiling default methods that refer to supertraits. + let _self_vtable_res = + lookup_vtables_for_param(&vcx, &loc_info, None, + ¶m_bounds, t, false); + } } }