Skip to content

Commit 7ca9436

Browse files
committed
Fix encoding of trait static method paths. Closes #4097. r=pcwalton
1 parent e71ec06 commit 7ca9436

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/librustc/metadata/encoder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Serializer,
768768
for traits.each |associated_trait| {
769769
encode_trait_ref(ebml_w, ecx, *associated_trait)
770770
}
771+
771772
ebml_w.end_tag();
772773

773774
// 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,
789790
let polyty = ecx.tcx.tcache.get(local_def(ty_m.id));
790791
encode_ty_type_param_bounds(ebml_w, ecx, polyty.bounds);
791792
encode_type(ecx, ebml_w, polyty.ty);
792-
encode_path(ecx, ebml_w, path, ast_map::path_name(ty_m.ident));
793+
let m_path = vec::append_one(path,
794+
ast_map::path_name(item.ident));
795+
encode_path(ecx, ebml_w, m_path, ast_map::path_name(ty_m.ident));
793796
ebml_w.end_tag();
794797
}
795798

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pub mod num {
2+
pub trait Num2 {
3+
static pure fn from_int2(n: int) -> self;
4+
}
5+
}
6+
7+
pub mod float {
8+
impl float: num::Num2 {
9+
static pure fn from_int2(n: int) -> float { return n as float; }
10+
}
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// aux-build:static_fn_trait_xc_aux.rs
2+
3+
extern mod mycore(name ="static_fn_trait_xc_aux");
4+
5+
use mycore::num;
6+
7+
fn main() {
8+
let _1:float = num::from_int2(1i);
9+
}

0 commit comments

Comments
 (0)