diff options
| author | Lindsey Kuper <lindsey@rockstargirl.org> | 2012-08-02 15:52:30 -0700 |
|---|---|---|
| committer | Lindsey Kuper <lindsey@rockstargirl.org> | 2012-08-02 17:15:36 -0700 |
| commit | 65e0e30e59351aed899adbb20cbd07ae98f213d3 (patch) | |
| tree | 5bb12d679c68a9f9ab2ac2df52aab2a38c6a3dfd /src/rustc | |
| parent | 2fe299d1a53355c9bb78b9067bd2d18bd4eb94e7 (diff) | |
| download | rust-65e0e30e59351aed899adbb20cbd07ae98f213d3.tar.gz rust-65e0e30e59351aed899adbb20cbd07ae98f213d3.zip | |
Make typeck::collect aware of provided methods in traits.
Diffstat (limited to 'src/rustc')
| -rw-r--r-- | src/rustc/middle/typeck.rs | 3 | ||||
| -rw-r--r-- | src/rustc/middle/typeck/collect.rs | 12 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index adc47d5fad4..910d57e875e 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -43,7 +43,8 @@ import syntax::{ast, ast_util, ast_map}; import ast::spanned; import ast::{required, provided}; import syntax::ast_map::node_id_to_str; -import syntax::ast_util::{local_def, respan, split_class_items}; +import syntax::ast_util::{local_def, respan, split_class_items, + split_trait_methods}; import syntax::visit; import metadata::csearch; import driver::session::session; diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index aab71d1b72b..da9575b898e 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -339,12 +339,22 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) { check_methods_against_trait(ccx, tps, rp, selfty, t, cms); } } - ast::item_trait(*) { + ast::item_trait(tps, trait_methods) { let tpt = ty_of_item(ccx, it); debug!{"item_trait(it.id=%d, tpt.ty=%s)", it.id, ty_to_str(tcx, tpt.ty)}; write_ty_to_tcx(tcx, it.id, tpt.ty); ensure_trait_methods(ccx, it.id); + + let (_, provided_methods) = split_trait_methods(trait_methods); + let selfty = ty::mk_self(tcx); + let {bounds, _} = mk_substs(ccx, tps, rp); + let _cms = convert_methods(ccx, provided_methods, rp, bounds, selfty); + // FIXME (#2616): something like this, when we start having + // trait inheritance? + // for trt.each |t| { + // check_methods_against_trait(ccx, tps, rp, selfty, t, cms); + // } } ast::item_class(tps, traits, members, m_ctor, m_dtor) { // Write the class type |
