Skip to content

Commit e3a91f6

Browse files
committed
Explain an odd conditional check.
1 parent cac97d7 commit e3a91f6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/librustc/metadata/encoder.rs

+11
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ fn encode_reexported_static_methods(ecx: @EncodeContext,
388388
match ecx.tcx.items.find(&exp.def_id.node) {
389389
Some(&ast_map::node_item(item, path)) => {
390390
let original_name = ecx.tcx.sess.str_of(item.ident);
391+
392+
//
393+
// We don't need to reexport static methods on traits
394+
// declared in the same module as our `pub use ...` since
395+
// that's done when we encode the trait item.
396+
//
397+
// The only exception is when the reexport *changes* the
398+
// name e.g. `pub use Foo = self::Bar` -- we have
399+
// encoded metadata for static methods relative to Bar,
400+
// but not yet for Foo.
401+
//
391402
if mod_path != *path || *exp.name != *original_name {
392403
for methods.each |&m| {
393404
if m.explicit_self == ast::sty_static {

0 commit comments

Comments
 (0)