mirror of https://github.com/rust-lang/rust.git
propagate obligations during overlap check
This commit is contained in:
parent
467aaab50e
commit
aa6c2b1cb7
|
@ -55,16 +55,15 @@ fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
|
||||||
debug!("overlap: b_impl_header={:?}", b_impl_header);
|
debug!("overlap: b_impl_header={:?}", b_impl_header);
|
||||||
|
|
||||||
// Do `a` and `b` unify? If not, no overlap.
|
// Do `a` and `b` unify? If not, no overlap.
|
||||||
match selcx.infcx().eq_impl_headers(true,
|
let obligations = match selcx.infcx().eq_impl_headers(true,
|
||||||
&ObligationCause::dummy(),
|
&ObligationCause::dummy(),
|
||||||
&a_impl_header,
|
&a_impl_header,
|
||||||
&b_impl_header) {
|
&b_impl_header) {
|
||||||
Ok(InferOk { obligations, .. }) => {
|
Ok(InferOk { obligations, .. }) => {
|
||||||
// FIXME(#32730) propagate obligations
|
obligations
|
||||||
assert!(obligations.is_empty());
|
|
||||||
}
|
}
|
||||||
Err(_) => return None
|
Err(_) => return None
|
||||||
}
|
};
|
||||||
|
|
||||||
debug!("overlap: unification check succeeded");
|
debug!("overlap: unification check succeeded");
|
||||||
|
|
||||||
|
@ -78,6 +77,7 @@ fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
|
||||||
.map(|p| Obligation { cause: ObligationCause::dummy(),
|
.map(|p| Obligation { cause: ObligationCause::dummy(),
|
||||||
recursion_depth: 0,
|
recursion_depth: 0,
|
||||||
predicate: p })
|
predicate: p })
|
||||||
|
.chain(obligations)
|
||||||
.find(|o| !selcx.evaluate_obligation(o));
|
.find(|o| !selcx.evaluate_obligation(o));
|
||||||
|
|
||||||
if let Some(failing_obligation) = opt_failing_obligation {
|
if let Some(failing_obligation) = opt_failing_obligation {
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
struct Function<T, F> { t: T, f: F }
|
||||||
|
|
||||||
|
impl<T, R> Function<T, fn() -> R> { fn foo() { } }
|
||||||
|
impl<T, R> Function<T, fn() -> R> { fn bar() { } }
|
||||||
|
|
||||||
|
fn main() { }
|
Loading…
Reference in New Issue