about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-12 02:05:11 +0000
committerbors <bors@rust-lang.org>2022-02-12 02:05:11 +0000
commitfc323035ac49b8d834fc2a0f580af8fd45e90b30 (patch)
tree3f21d01d0e1ad8c8313510c18e4fce71472a11b7 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentf19851069efd6ee1fe899a469f08ad2d66e76050 (diff)
parent5fc2e5623bd9dc53daf144626c9da2feb9daf682 (diff)
downloadrust-fc323035ac49b8d834fc2a0f580af8fd45e90b30.tar.gz
rust-fc323035ac49b8d834fc2a0f580af8fd45e90b30.zip
Auto merge of #93671 - Kobzol:stable-hash-const, r=the8472
Use const generics in SipHasher128's short_write

This was proposed by `@michaelwoerister` [here](https://github.com/rust-lang/rust/pull/93615#discussion_r799485554).
A few comments:
1) I tried to pass `&[u8; LEN]` instead of `[u8; LEN]`. Locally, it resulted in small icount regressions (about 0.5 %). When passing by value, there were no regressions (and no improvements).
2) I wonder if we should use `to_ne_bytes()` in `SipHasher128` to keep it generic and only use `to_le_bytes()` in `StableHasher`. However, currently `SipHasher128` is only used in `StableHasher` and the `short_write` method was private, so I couldn't use it directly from `StableHasher`. Using `to_le()` in the `StableHasher` was breaking this abstraction boundary before slightly.

```rust
debug_assert!(LEN <= 8);
```
This could be done at compile time, but actually I think that now we can remove this assert altogether.

r? `@the8472`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions