-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationF-extern_types`#![feature(extern_types)]``#![feature(extern_types)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
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
scottmcm
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationF-extern_types`#![feature(extern_types)]``#![feature(extern_types)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.