Is the comma in this error message supposed to be there?

I just got this error message:

    |
211 |                 .find(pred)
    |                       ^^^^ expected an `FnMut<(&(&'a row_info::RowInfo, &'a row_info::RowInfo),)>` closure, found `P`
    |

Toward the end of the type, that "),)>" -- is that comma supposed to be there, or is that a bug in the error message?

It's supposed to be there -- it indicates a one-tuple. (Otherwise it would just be a parenthesis wrapped expression.)

let x = (32); // type i32
let y = (32,); // type (i32,)

...as for actually interpretting what it means, the FnMut traits are defined in terms of tuples currently, so that's a closure that takes a single argument, which is a reference to a two-tuple.

5 Likes

The surprise to me is that this used the raw FnMut<Args> style at all, rather than FnMut(Arg...) sugar.

3 Likes