Skip to content

Commit 12dd2b8

Browse files
committed
---
yaml --- r: 68468 b: refs/heads/auto c: 57ee34c h: refs/heads/master v: v3
1 parent f5b1db8 commit 12dd2b8

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 817f98085f2332b604f0a2da5127f29c8fabc41f
17+
refs/heads/auto: 57ee34c2bf66a26527959b0a1dc2b7e23638e67b
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
609609
for ms.iter().advance |m| {
610610
check_method(ccx, *m);
611611
}
612+
vtable::resolve_impl(ccx, it);
612613
}
613614
ast::item_trait(_, _, ref trait_methods) => {
614615
for (*trait_methods).iter().advance |trait_method| {

branches/auto/src/librustc/middle/typeck/check/vtable.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

482488
pub 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.
666693
pub fn resolve_in_block(fcx: @mut FnCtxt, bl: &ast::blk) {

0 commit comments

Comments
 (0)