Skip to content

Commit 02d8c95

Browse files
committed
lint ImproperCTypes: remove the parts about checking value assumptions
it would be correct to lint on those, but this is deemed too steep a change for now, especially for projects that turn all warnings into errors
1 parent 06aeed6 commit 02d8c95

40 files changed

+360
-1351
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,10 @@ fn report_inline_asm(
466466
cgcx.diag_emitter.inline_asm_error(span, msg, level, source);
467467
}
468468

469-
unsafe extern "C" fn diagnostic_handler(info: Option<&DiagnosticInfo>, user: *mut c_void) {
469+
unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void) {
470470
if user.is_null() {
471471
return;
472472
}
473-
let info = info.unwrap();
474473
let (cgcx, dcx) =
475474
unsafe { *(user as *const (&CodegenContext<LlvmCodegenBackend>, DiagCtxtHandle<'_>)) };
476475

compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use libc::{c_char, c_uint};
55
use super::MetadataKindId;
66
use super::ffi::{AttributeKind, BasicBlock, Metadata, Module, Type, Value};
77
use crate::llvm::{Bool, Builder};
8-
use crate::wrap_returns_in_options;
98

10-
wrap_returns_in_options! {
119
#[link(name = "llvm-wrapper", kind = "static")]
1210
unsafe extern "C" {
1311
// Enzyme
@@ -16,7 +14,7 @@ unsafe extern "C" {
1614
pub(crate) fn LLVMRustGetLastInstruction<'a>(BB: &BasicBlock) -> Option<&'a Value>;
1715
pub(crate) fn LLVMRustDIGetInstMetadata(I: &Value) -> Option<&Metadata>;
1816
pub(crate) fn LLVMRustEraseInstFromParent(V: &Value);
19-
|wrap pub(crate) fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
17+
pub(crate) fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
2018
pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
2119
pub(crate) fn LLVMRustHasAttributeAtIndex(V: &Value, i: c_uint, Kind: AttributeKind) -> bool;
2220
pub(crate) fn LLVMRustGetArrayNumElements(Ty: &Type) -> u64;
@@ -48,11 +46,10 @@ unsafe extern "C" {
4846
pub(crate) fn LLVMDumpModule(M: &Module);
4947
pub(crate) fn LLVMDumpValue(V: &Value);
5048
pub(crate) fn LLVMGetFunctionCallConv(F: &Value) -> c_uint;
51-
|wrap pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type;
49+
pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type;
5250
pub(crate) fn LLVMGetParams(Fnc: &Value, params: *mut &Value);
5351
pub(crate) fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>;
5452
}
55-
}
5653

5754
#[repr(C)]
5855
#[derive(Copy, Clone, PartialEq)]

0 commit comments

Comments
 (0)