Closed
Description
fn f() { }
const fs: &[extern fn()] = &[f, f];
fn main() { for fs.each |&g| { g() } }
The type_of
(and sizing_type_of
) for that extern fn
is just a pointer, but what's getting generated for the constant also has an environment pointer. Because we have to defeat LLVM's type checks to support enums (and we don't have sufficient assertions of our own), we don't catch the mismatch and the second call to f
jumps through the first array element's null environment pointer instead.
Activity
jld commentedon Mar 3, 2013
This looks like febdb49 from #4808, or rather something that that change missed.
nikomatsakis commentedon Mar 3, 2013
Yeah, that's my fault. I forgot that constants have a different path.
Construct const fns based on the type, not the definition.
jld commentedon Mar 5, 2013
Fixed on incoming.
Auto merge of rust-lang#6905 - ThibsG:fpSingleComponentPathImports521…