populate impls *before* clonning the impls vec

This commit is contained in:
Flavio Percoco 2015-01-15 10:09:00 +01:00
parent 59775bb955
commit 2adc8b529a

View File

@ -39,7 +39,12 @@ fn check_for_overlapping_impls(&self) {
// check can populate this table further with impls from other
// crates.
let trait_def_ids: Vec<(ast::DefId, Vec<ast::DefId>)> =
self.tcx.trait_impls.borrow().iter().map(|(&k, v)| (k, v.borrow().clone())).collect();
self.tcx.trait_impls.borrow().iter().map(|(&k, v)| {
// FIXME -- it seems like this method actually pushes
// duplicate impls onto the list
ty::populate_implementations_for_trait_if_necessary(self.tcx, k);
(k, v.borrow().clone())
}).collect();
for &(trait_def_id, ref impls) in trait_def_ids.iter() {
self.check_for_overlapping_impls_of_trait(trait_def_id, impls);
@ -53,11 +58,6 @@ fn check_for_overlapping_impls_of_trait(&self,
debug!("check_for_overlapping_impls_of_trait(trait_def_id={})",
trait_def_id.repr(self.tcx));
// FIXME -- it seems like this method actually pushes
// duplicate impls onto the list
ty::populate_implementations_for_trait_if_necessary(self.tcx,
trait_def_id);
for (i, &impl1_def_id) in trait_impls.iter().enumerate() {
if impl1_def_id.krate != ast::LOCAL_CRATE {
// we don't need to check impls if both are external;