Pass a byte slice to coverageinfo::hash_bytes instead of an owned vector
The function body immediately treats it as a slice anyway, so this just makes it possible to call the hash function with arbitrary read-only byte slices.
This commit is contained in:
@@ -378,7 +378,7 @@ pub(crate) fn hash_str(strval: &str) -> u64 {
|
||||
unsafe { llvm::LLVMRustCoverageHashCString(strval.as_ptr()) }
|
||||
}
|
||||
|
||||
pub(crate) fn hash_bytes(bytes: Vec<u8>) -> u64 {
|
||||
pub(crate) fn hash_bytes(bytes: &[u8]) -> u64 {
|
||||
unsafe { llvm::LLVMRustCoverageHashByteArray(bytes.as_ptr().cast(), bytes.len()) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user