Skip to content

Commit 6a77c5b

Browse files
committed
---
yaml --- r: 174175 b: refs/heads/batch c: e644ca0 h: refs/heads/master i: 174173: 2667b33 174171: 181bde9 174167: 899076f 174159: 50c4374 174143: 8a8286c v: v3
1 parent ee56bc9 commit 6a77c5b

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 199e0cd804f039ccdd414e37fe68323061ba4aa7
32+
refs/heads/batch: e644ca0d6a61f243c8a3cb9708bae6da216bc5de
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928

branches/batch/src/librustc_typeck/coherence/overlap.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
3838
// check_for_overlapping_impls_of_trait() check, since that
3939
// check can populate this table further with impls from other
4040
// crates.
41-
let trait_def_ids: Vec<ast::DefId> =
42-
self.tcx.trait_impls.borrow().keys().map(|&d| d).collect();
41+
let trait_def_ids: Vec<(ast::DefId, Vec<ast::DefId>)> =
42+
self.tcx.trait_impls.borrow().iter().map(|(&k, v)|
43+
(k, v.borrow().clone())).collect();
4344

44-
for trait_def_id in trait_def_ids.iter() {
45-
self.check_for_overlapping_impls_of_trait(*trait_def_id);
45+
for &(trait_def_id, ref impls) in trait_def_ids.iter() {
46+
self.check_for_overlapping_impls_of_trait(trait_def_id, impls);
4647
}
4748
}
4849

4950
fn check_for_overlapping_impls_of_trait(&self,
50-
trait_def_id: ast::DefId)
51+
trait_def_id: ast::DefId,
52+
trait_impls: &Vec<ast::DefId>)
5153
{
5254
debug!("check_for_overlapping_impls_of_trait(trait_def_id={})",
5355
trait_def_id.repr(self.tcx));
@@ -57,17 +59,14 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
5759
ty::populate_implementations_for_trait_if_necessary(self.tcx,
5860
trait_def_id);
5961

60-
let mut impls = Vec::new();
61-
self.push_impls_of_trait(trait_def_id, &mut impls);
62-
63-
for (i, &impl1_def_id) in impls.iter().enumerate() {
62+
for (i, &impl1_def_id) in trait_impls.iter().enumerate() {
6463
if impl1_def_id.krate != ast::LOCAL_CRATE {
6564
// we don't need to check impls if both are external;
6665
// that's the other crate's job.
6766
continue;
6867
}
6968

70-
for &impl2_def_id in impls.slice_from(i+1).iter() {
69+
for &impl2_def_id in trait_impls.slice_from(i+1).iter() {
7170
self.check_if_impls_overlap(trait_def_id,
7271
impl1_def_id,
7372
impl2_def_id);
@@ -108,15 +107,6 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
108107
}
109108
}
110109

111-
fn push_impls_of_trait(&self,
112-
trait_def_id: ast::DefId,
113-
out: &mut Vec<ast::DefId>) {
114-
match self.tcx.trait_impls.borrow().get(&trait_def_id) {
115-
Some(impls) => { out.push_all(impls.borrow().as_slice()); }
116-
None => { /* no impls */ }
117-
}
118-
}
119-
120110
fn span_of_impl(&self, impl_did: ast::DefId) -> Span {
121111
assert_eq!(impl_did.krate, ast::LOCAL_CRATE);
122112
self.tcx.map.span(impl_did.node)

0 commit comments

Comments
 (0)