Mark some coverage-related bindings as safe
This commit is contained in:
@@ -6,21 +6,21 @@ use crate::coverageinfo::ffi;
|
||||
use crate::llvm;
|
||||
|
||||
pub(crate) fn covmap_var_name() -> CString {
|
||||
CString::new(llvm::build_byte_buffer(|s| unsafe {
|
||||
CString::new(llvm::build_byte_buffer(|s| {
|
||||
llvm::LLVMRustCoverageWriteCovmapVarNameToString(s);
|
||||
}))
|
||||
.expect("covmap variable name should not contain NUL")
|
||||
}
|
||||
|
||||
pub(crate) fn covmap_section_name(llmod: &llvm::Module) -> CString {
|
||||
CString::new(llvm::build_byte_buffer(|s| unsafe {
|
||||
CString::new(llvm::build_byte_buffer(|s| {
|
||||
llvm::LLVMRustCoverageWriteCovmapSectionNameToString(llmod, s);
|
||||
}))
|
||||
.expect("covmap section name should not contain NUL")
|
||||
}
|
||||
|
||||
pub(crate) fn covfun_section_name(llmod: &llvm::Module) -> CString {
|
||||
CString::new(llvm::build_byte_buffer(|s| unsafe {
|
||||
CString::new(llvm::build_byte_buffer(|s| {
|
||||
llvm::LLVMRustCoverageWriteCovfunSectionNameToString(llmod, s);
|
||||
}))
|
||||
.expect("covfun section name should not contain NUL")
|
||||
@@ -95,5 +95,5 @@ pub(crate) fn hash_bytes(bytes: &[u8]) -> u64 {
|
||||
/// as a raw numeric value. For historical reasons, the numeric value is 1 less
|
||||
/// than the number in the version's name, so `Version7` is actually `6u32`.
|
||||
pub(crate) fn mapping_version() -> u32 {
|
||||
unsafe { llvm::LLVMRustCoverageMappingVersion() }
|
||||
llvm::LLVMRustCoverageMappingVersion()
|
||||
}
|
||||
|
||||
@@ -2115,13 +2115,17 @@ unsafe extern "C" {
|
||||
NumBytes: size_t,
|
||||
) -> u64;
|
||||
|
||||
pub(crate) fn LLVMRustCoverageWriteCovmapSectionNameToString(M: &Module, OutStr: &RustString);
|
||||
pub(crate) safe fn LLVMRustCoverageWriteCovmapSectionNameToString(
|
||||
M: &Module,
|
||||
OutStr: &RustString,
|
||||
);
|
||||
pub(crate) safe fn LLVMRustCoverageWriteCovfunSectionNameToString(
|
||||
M: &Module,
|
||||
OutStr: &RustString,
|
||||
);
|
||||
pub(crate) safe fn LLVMRustCoverageWriteCovmapVarNameToString(OutStr: &RustString);
|
||||
|
||||
pub(crate) fn LLVMRustCoverageWriteCovfunSectionNameToString(M: &Module, OutStr: &RustString);
|
||||
|
||||
pub(crate) fn LLVMRustCoverageWriteCovmapVarNameToString(OutStr: &RustString);
|
||||
|
||||
pub(crate) fn LLVMRustCoverageMappingVersion() -> u32;
|
||||
pub(crate) safe fn LLVMRustCoverageMappingVersion() -> u32;
|
||||
pub(crate) fn LLVMRustDebugMetadataVersion() -> u32;
|
||||
pub(crate) fn LLVMRustVersionMajor() -> u32;
|
||||
pub(crate) fn LLVMRustVersionMinor() -> u32;
|
||||
|
||||
Reference in New Issue
Block a user