about summary refs log tree commit diff
path: root/library/core/src/hash
AgeCommit message (Collapse)AuthorLines
2025-07-02Remove some unsized tuple impls now that we don't support unsizing tuples ↵Oli Scherer-6/+1
anymore
2025-06-16library/compiler: add `PointeeSized` boundsDavid Wood-5/+5
As core uses an extern type (`ptr::VTable`), the default `?Sized` to `MetaSized` migration isn't sufficient, and some code that previously accepted `VTable` needs relaxed to continue to accept extern types. Similarly, the compiler uses many extern types in `rustc_codegen_llvm` and in the `rustc_middle::ty::List` implementation (`OpaqueListContents`) some bounds must be relaxed to continue to accept these types. Unfortunately, due to the current inability to relax `Deref::Target`, some of the bounds in the standard library are forced to be stricter than they ideally would be.
2025-03-06library: Use size_of from the prelude instead of importedThalia Archibald-5/+5
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-01-08fmtPietro Albini-4/+1
2025-01-08update version placeholdersPietro Albini-2/+2
2024-12-02stabilize const_collections_with_hasher and build_hasher_default_const_newRalf Jung-3/+3
2024-11-02remove const_hash feature leftoversRalf Jung-8/+4
2024-07-29Reformat `use` declarations.Nicholas Nethercote-10/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-01Optimize SipHash by reordering compress instructionsmat-5/+6
2024-06-27Mark `Hasher::finish` as #[must_use]Jake Goulding-0/+1
2024-03-29Add fn const BuildHasherDefault::newArthur Carcano-1/+13
Because `HashMap::with_hasher` constness is being stabilized this will in turn allow creating empty HashMap<K,V,BuildHasherDefault<H>> in const context for any H: Default + Hasher.
2024-03-20step cfgsMark Rousskov-1/+1
2024-02-17Allow newly added non_local_definitions in stdUrgau-0/+1
2023-11-02Add insta-stable std::hash::{DefaultHasher, RandomState} exportsltdk-38/+17
2023-09-06clarify that unsafe code must not rely on our safe traitsRalf Jung-0/+5
2023-05-30Swap out CURRENT_RUSTC_VERSION to 1.71.0Mark Rousskov-1/+1
2023-05-24Stabilize `BuildHasher::hash_one`Scott McMurray-3/+1
2023-04-16core is now compilableDeadbeef-16/+3
2023-04-16rm const traits in libcoreDeadbeef-55/+36
2023-03-18Rollup merge of #109287 - scottmcm:hash-slice-size-of-val, r=oli-obkMatthias Krüger-1/+1
Use `size_of_val` instead of manual calculation Very minor thing that I happened to notice in passing, but it's both shorter and [means it gets `mul nsw`](https://rust.godbolt.org/z/Y9KxYETv5), so why not.
2023-03-17Use `size_of_val` instead of manual calculationScott McMurray-1/+1
Very minor thing that I happened to notice in passing, but it's both shorter and means it gets `mul nuw`, so why not.
2023-03-15unequal → not equalgimbles-1/+1
2022-12-20Fix some `~const` usage in libcoreOli Scherer-2/+2
2022-11-08Test const `Hash`, fix nitsonestacked-9/+16
2022-11-07Removed unnecessary Trait boundonestacked-4/+1
2022-11-06Added `const_hash` tracking issue idonestacked-18/+18
2022-11-06Made `Sip` const `Hasher`onestacked-14/+24
2022-11-04Make `BuildHasher` const_traitonestacked-3/+6
2022-11-04Made `Hash` and `Hasher` const_traitonestacked-24/+44
2022-08-12Adjust cfgsMark Rousskov-1/+1
2022-07-17rustdoc: extend `#[doc(tuple_variadic)]` to fn pointersMichael Howell-1/+1
The attribute is also renamed `fake_variadic`.
2022-07-05Fix links in std/core documentationGuillaume Gomez-1/+1
2022-07-01update cfg(bootstrap)sPietro Albini-1/+1
2022-06-16Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomezbors-19/+36
Improve the tuple and unit trait docs * Reduce duplicate impls; show only the `(T,)` and include a sentence saying that there exists ones up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`. Here's the new version: * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html> * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.unit.html>
2022-06-11docs: make all the variadic impls use `(T, ...)` exactlyMichael Howell-12/+12
2022-06-11Fix incorrectly spelled "variadic"Michael Howell-1/+1
2022-06-10Use relative links instead of linking to doc.rust-lang.org when possibleGuillaume Gomez-1/+1
2022-06-08rustdoc: show tuple impls as `impl Trait for (T, ...)`Michael Howell-0/+1
This commit adds a new unstable attribute, `#[doc(tuple_varadic)]`, that shows a 1-tuple as `(T, ...)` instead of just `(T,)`, and links to a section in the tuple primitive docs that talks about these.
2022-06-07docs: clean up trait docs for tuplesMichael Howell-7/+23
2022-05-30Reword safety comments in core/hash/sip.rsThom Chiovoloni-2/+4
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-20/+11
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-05-07Further elaborate the lack of guarantees from `Hasher`Scott McMurray-2/+21
2022-05-06For now, don't change the details of hashing a `str`Scott McMurray-21/+52
We might want to change the default before stabilizing (or maybe even after), but for getting in the new unstable methods, leave it as-is for now. That way it won't break cargo and such.
2022-05-06Add a dedicated length-prefixing method to `Hasher`Scott McMurray-3/+122
This accomplishes two main goals: - Make it clear who is responsible for prefix-freedom, including how they should do it - Make it feasible for a `Hasher` that *doesn't* care about Hash-DoS resistance to get better performance by not hashing lengths This does not change rustc-hash, since that's in an external crate, but that could potentially use it in future.
2022-04-14Remove use of `#[rustc_deprecated]`Jacob Pratt-20/+11
2022-03-29Make the stdlib largely conform to strict provenance.Aria Beingessner-2/+2
Some things like the unwinders and system APIs are not fully conformant, this only covers a lot of low-hanging fruit.
2022-01-07change PhantomData type for BuildHasherDefaultFrank Steffahn-1/+1
2021-11-23Apply suggestions from code reviewthe8472-2/+2
Co-authored-by: pierwill <19642016+pierwill@users.noreply.github.com>
2021-11-18Document non-guarantees for HashThe8472-0/+13
Dependence on endianness and type sizes was reported for enum discriminants in #74215 but it is a more general issue since for example the default implementation of `Hasher::write_usize` uses native endianness. Additionally the implementations of library types are occasionally changed as their internal fields change or hashing gets optimized.
2021-10-11Rollup merge of #89729 - jkugelman:must-use-core-std-constructors, ↵Guillaume Gomez-0/+2
r=joshtriplett Add #[must_use] to core and std constructors Parent issue: #89692 r? ``@joshtriplett``