Normalize obligations for closure confirmation
This commit is contained in:
parent
347d503333
commit
cacc3ee801
17 changed files with 263 additions and 87 deletions
|
|
@ -1,30 +0,0 @@
|
|||
pub trait Foo<'a> {
|
||||
type Bar;
|
||||
fn foo(&'a self) -> Self::Bar;
|
||||
}
|
||||
|
||||
impl<'a, 'b, T: 'a> Foo<'a> for &'b T {
|
||||
type Bar = &'a T;
|
||||
fn foo(&'a self) -> &'a T {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn uncallable<T, F>(x: T, f: F)
|
||||
where
|
||||
T: for<'a> Foo<'a>,
|
||||
F: for<'a> Fn(<T as Foo<'a>>::Bar),
|
||||
{
|
||||
f(x.foo());
|
||||
}
|
||||
|
||||
pub fn catalyst(x: &i32) {
|
||||
broken(x, |_| {})
|
||||
}
|
||||
|
||||
pub fn broken<F: Fn(&i32)>(x: &i32, f: F) {
|
||||
uncallable(x, |y| f(y));
|
||||
//~^ type mismatch
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/issue-44005.rs:26:5
|
||||
|
|
||||
LL | uncallable(x, |y| f(y));
|
||||
| ^^^^^^^^^^ -------- found signature of `for<'r> fn(&'r i32) -> _`
|
||||
| |
|
||||
| expected signature of `for<'a> fn(<&i32 as Foo<'a>>::Bar) -> _`
|
||||
|
|
||||
note: required by a bound in `uncallable`
|
||||
--> $DIR/issue-44005.rs:16:8
|
||||
|
|
||||
LL | pub fn uncallable<T, F>(x: T, f: F)
|
||||
| ---------- required by a bound in this
|
||||
...
|
||||
LL | F: for<'a> Fn(<T as Foo<'a>>::Bar),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `uncallable`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0631`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue