-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Labels
Description
pub fn new<'b, T>(
value: &'b T,
formatter: fn(&T, &mut Formatter<'_>),
) -> Argument<'b> { ... }
fn int_formatter(value: &i32, _: &mut Formatter<'_>) {
unsafe {
puts("hell yeah!\n\0" as *const str as *const i8);
}
}
fn main() {
let a = 15;
let a = Argument::new(&15, int_formatter);
}
should work, but errors out with this instead:
extern_types_test.rs:61:32: error: mismatched types, expected ‘fnptr (& T=T REF: 65 ,&mut Formatter{Formatter (0:& ())} ,) -> Result{Result {}}’ but got ‘fn (value & i32,_ &mut Formatter{Formatter (0:& ())},) -> Result{Result {}}’ [E0308]
29 | formatter: fn(&T, &mut Formatter<'_>) -> Result,
| ~~~~~~~~~
......
61 | let a = Argument::new(&15, int_formatter);
| ^~~~~~~~~~~~~
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In Progress