move the signature into the closure type
This commit is contained in:
parent
54f4f396d9
commit
d0bda669ea
9 changed files with 66 additions and 26 deletions
|
|
@ -13,8 +13,7 @@ fn bar<F>(blk: F) where F: FnOnce() + 'static {
|
|||
|
||||
fn foo(x: &()) {
|
||||
bar(|| {
|
||||
//~^ ERROR cannot infer
|
||||
//~| ERROR does not fulfill
|
||||
//~^ ERROR does not fulfill
|
||||
let _ = x;
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@
|
|||
fn g<F>(_: F) where F: FnOnce(Option<F>) {}
|
||||
|
||||
fn main() {
|
||||
g(|_| { });
|
||||
g(|_| { }); //~ ERROR mismatched types
|
||||
}
|
||||
|
|
@ -15,5 +15,5 @@ fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
fix(|_, x| x);
|
||||
fix(|_, x| x); //~ ERROR mismatched types
|
||||
}
|
||||
|
|
@ -6,16 +6,5 @@ error[E0599]: no method named `b` found for type `&Self` in the current scope
|
|||
|
|
||||
= help: did you mean `a`?
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-3563.rs:13:9
|
||||
|
|
||||
12 | fn a(&self) {
|
||||
| - possibly return type missing here?
|
||||
13 | || self.b()
|
||||
| ^^^^^^^^^^^ expected (), found closure
|
||||
|
|
||||
= note: expected type `()`
|
||||
found type `[closure@$DIR/issue-3563.rs:13:9: 13:20 self:_]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue