about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2013-07-19 17:19:04 -0700
committerMichael Sullivan <sully@msully.net>2013-07-23 17:06:33 -0700
commit304a5f07867cff4cb6a558d320efafd7c6da56c3 (patch)
tree83a1f8cdc8bd545fb8033267b4a4065c55b5f584
parenta0f8540c9571dadb9af542799156cc8a96263c41 (diff)
downloadrust-304a5f07867cff4cb6a558d320efafd7c6da56c3.tar.gz
rust-304a5f07867cff4cb6a558d320efafd7c6da56c3.zip
Have vtable resolution check for supertrait bounds. Closes #4055.
-rw-r--r--src/librustc/middle/typeck/check/vtable.rs17
1 files changed, 17 insertions, 0 deletions
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,
+                                         &param_bounds, t, false);
+
         }
     }
 }