about summary refs log tree commit diff
path: root/src/librustc/metadata
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2013-07-11 15:08:43 -0700
committerMichael Sullivan <sully@msully.net>2013-07-11 15:51:10 -0700
commit186f6faf1e6f4b507d97fefcb02fd8a7cf8d716f (patch)
treeb5b0c24a133e581034649a3498699e5d68d61a2b /src/librustc/metadata
parent1bbb4348806dab6d9b4c280d4cfd324645969eca (diff)
downloadrust-186f6faf1e6f4b507d97fefcb02fd8a7cf8d716f.tar.gz
rust-186f6faf1e6f4b507d97fefcb02fd8a7cf8d716f.zip
Get cross crate static default methods working. Closes #7569.
Diffstat (limited to 'src/librustc/metadata')
-rw-r--r--src/librustc/metadata/encoder.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index a9f3200af12..b2fefdd97b8 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -791,7 +791,7 @@ fn encode_info_for_method(ecx: &EncodeContext,
     if len > 0u || should_inline {
         (ecx.encode_inlined_item)(
            ecx, ebml_w, impl_path,
-           ii_method(local_def(parent_id), m));
+           ii_method(local_def(parent_id), false, m));
     } else {
         encode_symbol(ecx, ebml_w, m.id);
     }
@@ -1123,21 +1123,16 @@ fn encode_info_for_item(ecx: &EncodeContext,
                 }
 
                 provided(m) => {
-                    // This is obviously a bogus assert but I don't think this
-                    // ever worked before anyhow...near as I can tell, before
-                    // we would emit two items.
-                    if method_ty.explicit_self == sty_static {
-                        tcx.sess.span_unimpl(
-                            item.span,
-                            fmt!("Method %s is both provided and static",
-                                 token::ident_to_str(&method_ty.ident)));
+                    // If this is a static method, we've already encoded
+                    // this.
+                    if method_ty.explicit_self != sty_static {
+                        encode_type_param_bounds(ebml_w, ecx,
+                                                 &m.generics.ty_params);
                     }
-                    encode_type_param_bounds(ebml_w, ecx,
-                                             &m.generics.ty_params);
                     encode_method_sort(ebml_w, 'p');
                     (ecx.encode_inlined_item)(
                         ecx, ebml_w, path,
-                        ii_method(local_def(item.id), m));
+                        ii_method(local_def(item.id), true, m));
                 }
             }