Skip to content

ICE when calling static and static mut function pointers. #8588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brendanzab opened this issue Aug 18, 2013 · 0 comments
Closed

ICE when calling static and static mut function pointers. #8588

brendanzab opened this issue Aug 18, 2013 · 0 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@brendanzab
Copy link
Member

fn f(x: int) -> int { x }

static mut F: extern fn(x: int) -> int = f;

fn main() {
    unsafe { F(1) }
}
error: internal compiler error: Cannot translate def def_static({crate: 0, node: 23}, true) to a callable thing!

Seems to have been resolved a while ago (#4523), but is still occurring. @Aatch has said this should be an easy fix, it just needs to be done. This is important for the OpengGL function loader.

@bors bors closed this as completed in a106613 Aug 22, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 7, 2022
`indexing_slicing` should not fire if a valid array index comes from a constant function that is evaluated at compile-time

fix rust-lang#8348

changelog: [`indexing_slicing`] fewer false positives in `const` contexts and with `const` indices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant