Skip to content

Commit aa6c2b1

Browse files
committed
propagate obligations during overlap check
1 parent 467aaab commit aa6c2b1

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/librustc/traits/coherence.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
5555
debug!("overlap: b_impl_header={:?}", b_impl_header);
5656

5757
// Do `a` and `b` unify? If not, no overlap.
58-
match selcx.infcx().eq_impl_headers(true,
58+
let obligations = match selcx.infcx().eq_impl_headers(true,
5959
&ObligationCause::dummy(),
6060
&a_impl_header,
6161
&b_impl_header) {
6262
Ok(InferOk { obligations, .. }) => {
63-
// FIXME(#32730) propagate obligations
64-
assert!(obligations.is_empty());
63+
obligations
6564
}
6665
Err(_) => return None
67-
}
66+
};
6867

6968
debug!("overlap: unification check succeeded");
7069

@@ -78,6 +77,7 @@ fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
7877
.map(|p| Obligation { cause: ObligationCause::dummy(),
7978
recursion_depth: 0,
8079
predicate: p })
80+
.chain(obligations)
8181
.find(|o| !selcx.evaluate_obligation(o));
8282

8383
if let Some(failing_obligation) = opt_failing_obligation {

src/test/run-pass/issue-41298.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Function<T, F> { t: T, f: F }
12+
13+
impl<T, R> Function<T, fn() -> R> { fn foo() { } }
14+
impl<T, R> Function<T, fn() -> R> { fn bar() { } }
15+
16+
fn main() { }

0 commit comments

Comments
 (0)