|
| 1 | +error[E0593]: function is expected to take 1 argument, but it takes 0 arguments |
| 2 | + --> $DIR/foreign-safe-fn-arg-mismatch.rs:11:10 |
| 3 | + | |
| 4 | +LL | pub safe fn foo(); |
| 5 | + | ------------------ takes 0 arguments |
| 6 | +... |
| 7 | +LL | test(foo); |
| 8 | + | ---- ^^^ expected function that takes 1 argument |
| 9 | + | | |
| 10 | + | required by a bound introduced by this call |
| 11 | + | |
| 12 | +note: required by a bound in `test` |
| 13 | + --> $DIR/foreign-safe-fn-arg-mismatch.rs:8:17 |
| 14 | + | |
| 15 | +LL | fn test(_: impl Fn(i32)) {} |
| 16 | + | ^^^^^^^ required by this bound in `test` |
| 17 | + |
| 18 | +error[E0631]: type mismatch in function arguments |
| 19 | + --> $DIR/foreign-safe-fn-arg-mismatch.rs:12:10 |
| 20 | + | |
| 21 | +LL | pub safe fn bar(x: u32); |
| 22 | + | ------------------------ found signature defined here |
| 23 | +... |
| 24 | +LL | test(bar); |
| 25 | + | ---- ^^^ expected due to this |
| 26 | + | | |
| 27 | + | required by a bound introduced by this call |
| 28 | + | |
| 29 | + = note: expected function signature `fn(i32) -> _` |
| 30 | + found function signature `fn(u32) -> _` |
| 31 | +note: required by a bound in `test` |
| 32 | + --> $DIR/foreign-safe-fn-arg-mismatch.rs:8:17 |
| 33 | + | |
| 34 | +LL | fn test(_: impl Fn(i32)) {} |
| 35 | + | ^^^^^^^ required by this bound in `test` |
| 36 | +help: consider wrapping the function in a closure |
| 37 | + | |
| 38 | +LL | test(|arg0: i32| bar(/* u32 */)); |
| 39 | + | +++++++++++ +++++++++++ |
| 40 | + |
| 41 | +error: aborting due to 2 previous errors |
| 42 | + |
| 43 | +Some errors have detailed explanations: E0593, E0631. |
| 44 | +For more information about an error, try `rustc --explain E0593`. |
0 commit comments