Skip to content

Commit 225c3ef

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 f24ff07 commit 225c3ef

35 files changed

+352
-1481
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

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

465-
unsafe extern "C" fn diagnostic_handler(info: Option<&DiagnosticInfo>, user: *mut c_void) {
465+
unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void) {
466466
if user.is_null() {
467467
return;
468468
}
469-
let info = info.unwrap();
470469
let (cgcx, dcx) =
471470
unsafe { *(user as *const (&CodegenContext<LlvmCodegenBackend>, DiagCtxtHandle<'_>)) };
472471

compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

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

11-
wrap_returns_in_options! {
1210
#[link(name = "llvm-wrapper", kind = "static")]
1311
unsafe extern "C" {
1412
// Enzyme
@@ -17,7 +15,7 @@ unsafe extern "C" {
1715
pub(crate) fn LLVMRustGetLastInstruction<'a>(BB: &BasicBlock) -> Option<&'a Value>;
1816
pub(crate) fn LLVMRustDIGetInstMetadata(I: &Value) -> Option<&Metadata>;
1917
pub(crate) fn LLVMRustEraseInstFromParent(V: &Value);
20-
|wrap pub(crate) fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
18+
pub(crate) fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
2119
pub(crate) fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
2220
pub(crate) fn LLVMRustHasAttributeAtIndex(V: &Value, i: c_uint, Kind: AttributeKind) -> bool;
2321
pub(crate) fn LLVMRustGetArrayNumElements(Ty: &Type) -> u64;
@@ -41,11 +39,10 @@ unsafe extern "C" {
4139
pub(crate) fn LLVMDumpModule(M: &Module);
4240
pub(crate) fn LLVMDumpValue(V: &Value);
4341
pub(crate) fn LLVMGetFunctionCallConv(F: &Value) -> c_uint;
44-
|wrap pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type;
42+
pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type;
4543
pub(crate) fn LLVMGetParams(Fnc: &Value, parms: *mut &Value);
4644
pub(crate) fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>;
4745
}
48-
}
4946

5047
#[repr(C)]
5148
#[derive(Copy, Clone, PartialEq)]

0 commit comments

Comments
 (0)