Closed
Description
Currently, in a situation like
extern {
type Foo;
static mut BAR: Foo;
}
we generate a zero-sized struct as the LLVM type for Foo
. LLVM might use this to assume that BAR
has size 0, which would be fatal. And anyway it seems prudent for extern types, that should match C's declared-but-not-defined types, to match what Clang does for the corresponding C types -- which is to use opaque
.
See #58271 for an attempt to fix this, which ran into LLVM assertion failures.
Cc @eddyb
Metadata
Metadata
Assignees
Labels
Area: Foreign function interface (FFI)Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation`#![feature(extern_types)]`Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.