Skip to content

Commit

Permalink
Do not resolve inherent static methods from other crates prematurely
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jul 16, 2016
1 parent 60564d0 commit f66da5e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
26 changes: 0 additions & 26 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,32 +687,6 @@ fn each_child_of_item_or_crate<F, G>(cdata: Cmd,
}
}

// As a special case, iterate over all static methods of
// associated implementations too. This is a bit of a botch.
// --pcwalton
for inherent_impl_def_id_doc in reader::tagged_docs(item_doc,
tag_items_data_item_inherent_impl) {
let inherent_impl_def_id = item_def_id(inherent_impl_def_id_doc, cdata);
if let Some(inherent_impl_doc) = cdata.get_item(inherent_impl_def_id.index) {
for impl_item_def_id_doc in reader::tagged_docs(inherent_impl_doc,
tag_item_impl_item) {
let impl_item_def_id = item_def_id(impl_item_def_id_doc,
cdata);
if let Some(impl_method_doc) = cdata.get_item(impl_item_def_id.index) {
if let StaticMethod = item_family(impl_method_doc) {
// Hand off the static method to the callback.
let static_method_name = item_name(impl_method_doc);
let static_method_def_like = item_to_def_like(cdata, impl_method_doc,
impl_item_def_id);
callback(static_method_def_like,
static_method_name,
item_visibility(impl_method_doc));
}
}
}
}
}

for reexport_doc in reexports(item_doc) {
let def_id_doc = reader::get_doc(reexport_doc,
tag_items_data_item_reexport_def_id);
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/use-from-trait-xc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ use use_from_trait_xc::Bar::new as bnew;
//~^ ERROR unresolved import `use_from_trait_xc::Bar::new`

use use_from_trait_xc::Baz::new as baznew;
//~^ ERROR `baznew` is not directly importable
//~^ ERROR unresolved import `use_from_trait_xc::Baz::new`

fn main() {}

0 comments on commit f66da5e

Please sign in to comment.