Skip to content

Commit ab274da

Browse files
committed
---
yaml --- r: 176047 b: refs/heads/try c: e644ca0 h: refs/heads/master i: 176045: 1bbb4d6 176043: bdcd9c8 176039: 8e9c8b7 176031: a6b5d8a v: v3
1 parent 1b3ecd3 commit ab274da

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
@@ -2,7 +2,7 @@
22
refs/heads/master: a530cc9706324ad44dba464d541a807eb5afdb08
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 777435990e0e91df6b72ce80c9b6fa485eeb5daa
5-
refs/heads/try: 199e0cd804f039ccdd414e37fe68323061ba4aa7
5+
refs/heads/try: e644ca0d6a61f243c8a3cb9708bae6da216bc5de
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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)