Closed
Description
The following code compiles and works as expected:
let a = &"something".all(|c: char| -> bool { c == 'a' });
This code, however:
let char_is_a = fn&(c: char) -> bool { c == 'a' };
let b = &"something".all(char_is_a);
gives the following error:
str_tut.rs:28:26: 28:35 error: mismatched types: expected `fn&(++:char) -> bool` but found `fn&(char) -> bool` (expected argument mode ++, but found +)
str_tut.rs:28 let b = &"something".all(char_is_a);
^~~~~~~~~
error: aborting due to previous error
If I add the mode to the char_is_a
definition, it works. It just seems odd to have this discrepancy.
Metadata
Metadata
Assignees
Labels
No labels