creusot icon indicating copy to clipboard operation
creusot copied to clipboard

Panic on using function pointer

Open gmorenz opened this issue 1 year ago • 1 comments

I'd have been somewhat surprised if this code worked, but it should probably return an error message instead of a panic

fn some_fn_pointer() -> i32 {
    2
}

fn main() {
    let x = &some_fn_pointer;
    let y = x();
}

Panics here.

gmorenz avatar Oct 04 '22 02:10 gmorenz