Function pointers are not getting monormophized fully
Open
@CohenArthur is already working on this.
Since Feb 29, 2024.
bug
typechecking
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 19h 55m
- Merged PRs (30d)
- 67
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);
| ^~~~~~~~~~~~~
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.