Fix encoding of trait static method paths. Closes #4097. r=pcwalton

This commit is contained in:
Brian Anderson 2012-12-13 14:55:08 -08:00
parent e71ec06118
commit 7ca94369da
3 changed files with 24 additions and 1 deletions

View file

@ -768,6 +768,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Serializer,
for traits.each |associated_trait| {
encode_trait_ref(ebml_w, ecx, *associated_trait)
}
ebml_w.end_tag();
// Now, output all of the static methods as items. Note that for the
@ -789,7 +790,9 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Serializer,
let polyty = ecx.tcx.tcache.get(local_def(ty_m.id));
encode_ty_type_param_bounds(ebml_w, ecx, polyty.bounds);
encode_type(ecx, ebml_w, polyty.ty);
encode_path(ecx, ebml_w, path, ast_map::path_name(ty_m.ident));
let m_path = vec::append_one(path,
ast_map::path_name(item.ident));
encode_path(ecx, ebml_w, m_path, ast_map::path_name(ty_m.ident));
ebml_w.end_tag();
}

View file

@ -0,0 +1,11 @@
pub mod num {
pub trait Num2 {
static pure fn from_int2(n: int) -> self;
}
}
pub mod float {
impl float: num::Num2 {
static pure fn from_int2(n: int) -> float { return n as float; }
}
}

View file

@ -0,0 +1,9 @@
// aux-build:static_fn_trait_xc_aux.rs
extern mod mycore(name ="static_fn_trait_xc_aux");
use mycore::num;
fn main() {
let _1:float = num::from_int2(1i);
}