about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTom Lee <github@tomlee.co>2013-05-18 21:31:55 -0700
committerTom Lee <github@tomlee.co>2013-05-19 17:07:18 -0700
commite3a91f60c58d537945abc4c83b1b9f6ddcbe21fe (patch)
tree3e20c14c516aaaca6c3cc03e63079d4146e1295e
parentcac97d7ee565eef14b9e7385d1c088c1eb0a9295 (diff)
downloadrust-e3a91f60c58d537945abc4c83b1b9f6ddcbe21fe.tar.gz
rust-e3a91f60c58d537945abc4c83b1b9f6ddcbe21fe.zip
Explain an odd conditional check.
-rw-r--r--src/librustc/metadata/encoder.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 110d17b9b15..460da5d60b3 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -388,6 +388,17 @@ fn encode_reexported_static_methods(ecx: @EncodeContext,
             match ecx.tcx.items.find(&exp.def_id.node) {
                 Some(&ast_map::node_item(item, path)) => {
                     let original_name = ecx.tcx.sess.str_of(item.ident);
+
+                    //
+                    // We don't need to reexport static methods on traits
+                    // declared in the same module as our `pub use ...` since
+                    // that's done when we encode the trait item.
+                    //
+                    // The only exception is when the reexport *changes* the
+                    // name e.g. `pub use Foo = self::Bar` -- we have
+                    // encoded metadata for static methods relative to Bar,
+                    // but not yet for Foo.
+                    //
                     if mod_path != *path || *exp.name != *original_name {
                         for methods.each |&m| {
                             if m.explicit_self == ast::sty_static {