Skip to content

Commit 2adc8b5

Browse files
committed
populate impls *before* clonning the impls vec
1 parent 59775bb commit 2adc8b5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustc_typeck/coherence/overlap.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
3939
// check can populate this table further with impls from other
4040
// crates.
4141
let trait_def_ids: Vec<(ast::DefId, Vec<ast::DefId>)> =
42-
self.tcx.trait_impls.borrow().iter().map(|(&k, v)| (k, v.borrow().clone())).collect();
42+
self.tcx.trait_impls.borrow().iter().map(|(&k, v)| {
43+
// FIXME -- it seems like this method actually pushes
44+
// duplicate impls onto the list
45+
ty::populate_implementations_for_trait_if_necessary(self.tcx, k);
46+
(k, v.borrow().clone())
47+
}).collect();
4348

4449
for &(trait_def_id, ref impls) in trait_def_ids.iter() {
4550
self.check_for_overlapping_impls_of_trait(trait_def_id, impls);
@@ -53,11 +58,6 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
5358
debug!("check_for_overlapping_impls_of_trait(trait_def_id={})",
5459
trait_def_id.repr(self.tcx));
5560

56-
// FIXME -- it seems like this method actually pushes
57-
// duplicate impls onto the list
58-
ty::populate_implementations_for_trait_if_necessary(self.tcx,
59-
trait_def_id);
60-
6161
for (i, &impl1_def_id) in trait_impls.iter().enumerate() {
6262
if impl1_def_id.krate != ast::LOCAL_CRATE {
6363
// we don't need to check impls if both are external;

0 commit comments

Comments
 (0)