diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-07-13 11:21:21 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-07-13 11:28:50 +1000 |
| commit | 7a5ad35da4e5fd8cb4ec5bf181dbb75afd5dade9 (patch) | |
| tree | 2adf13a3b437eb942cd15019cc4102f28030916f /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs | |
| parent | 29c53d87481913511955c7bb33826899b964f2fe (diff) | |
| download | rust-7a5ad35da4e5fd8cb4ec5bf181dbb75afd5dade9.tar.gz rust-7a5ad35da4e5fd8cb4ec5bf181dbb75afd5dade9.zip | |
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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs index 42fdbd78618..090e88003d6 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs @@ -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()) } } |
