1
Fork 0

codegen_llvm: avoid Deref impls w/ extern type

`rustc_codegen_llvm` relied on `Deref` impls where `Deref::Target` was
or contained an extern type - in my experimental implementation of
rust-lang/rfcs#3729, this isn't possible as the `Target` associated
type's `?Sized` bound cannot be relaxed backwards compatibly (unless we
come up with some way of doing this).

In later pull requests with the rust-lang/rfcs#3729 implementation,
breakage like this could only occur for nightly users relying on the
`extern_types` feature.

Upstreaming this to avoid needing to keep carrying this patch locally,
and I think it'll necessarily need to change eventually.
This commit is contained in:
David Wood 2025-02-04 12:20:09 +00:00
parent ad27045c31
commit a5615d3c62
No known key found for this signature in database
8 changed files with 31 additions and 30 deletions

View file

@ -205,7 +205,7 @@ pub(crate) unsafe fn create_module<'ll>(
{
let tm = crate::back::write::create_informational_target_machine(tcx.sess, false);
unsafe {
llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, &tm);
llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm.raw());
}
let llvm_data_layout = unsafe { llvm::LLVMGetDataLayoutStr(llmod) };