Explain an odd conditional check.

This commit is contained in:
Tom Lee 2013-05-18 21:31:55 -07:00
parent cac97d7ee5
commit e3a91f60c5

View File

@ -388,6 +388,17 @@ fn encode_reexported_static_methods(ecx: @EncodeContext,
match ecx.tcx.items.find(&exp.def_id.node) { match ecx.tcx.items.find(&exp.def_id.node) {
Some(&ast_map::node_item(item, path)) => { Some(&ast_map::node_item(item, path)) => {
let original_name = ecx.tcx.sess.str_of(item.ident); 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 { if mod_path != *path || *exp.name != *original_name {
for methods.each |&m| { for methods.each |&m| {
if m.explicit_self == ast::sty_static { if m.explicit_self == ast::sty_static {