Skip to content

Commit 5482043

Browse files
committed
---
yaml --- r: 185453 b: refs/heads/master c: 206c254 h: refs/heads/master i: 185451: fcc0e63 v: v3
1 parent c062068 commit 5482043

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: eb841fc44a821fdfd23117b3a35958935752c857
2+
refs/heads/master: 206c2546c03c5d28aea3752f5746c9e161ee3692
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77

trunk/src/librustc/middle/traits/coherence.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,16 @@ fn overlap(selcx: &mut SelectionContext,
5252
b_def_id: ast::DefId)
5353
-> bool
5454
{
55+
debug!("overlap(a_def_id={}, b_def_id={})",
56+
a_def_id.repr(selcx.tcx()),
57+
b_def_id.repr(selcx.tcx()));
58+
5559
let (a_trait_ref, a_obligations) = impl_trait_ref_and_oblig(selcx, a_def_id);
5660
let (b_trait_ref, b_obligations) = impl_trait_ref_and_oblig(selcx, b_def_id);
5761

62+
debug!("overlap: a_trait_ref={}", a_trait_ref.repr(selcx.tcx()));
63+
debug!("overlap: b_trait_ref={}", b_trait_ref.repr(selcx.tcx()));
64+
5865
// Does `a <: b` hold? If not, no overlap.
5966
if let Err(_) = infer::mk_sub_poly_trait_refs(selcx.infcx(),
6067
true,
@@ -64,10 +71,20 @@ fn overlap(selcx: &mut SelectionContext,
6471
return false;
6572
}
6673

74+
debug!("overlap: subtraitref check succeeded");
75+
6776
// Are any of the obligations unsatisfiable? If so, no overlap.
68-
a_obligations.iter()
69-
.chain(b_obligations.iter())
70-
.all(|o| selcx.evaluate_obligation(o))
77+
let opt_failing_obligation =
78+
a_obligations.iter()
79+
.chain(b_obligations.iter())
80+
.find(|o| !selcx.evaluate_obligation(o));
81+
82+
if let Some(failing_obligation) = opt_failing_obligation {
83+
debug!("overlap: obligation unsatisfiable {}", failing_obligation.repr(selcx.tcx()));
84+
return false;
85+
}
86+
87+
true
7188
}
7289

7390
/// Instantiate fresh variables for all bound parameters of the impl

0 commit comments

Comments
 (0)