about summary refs log tree commit diff
path: root/library/core/src/alloc
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-05-28 08:45:51 +0200
committerGitHub <noreply@github.com>2022-05-28 08:45:51 +0200
commit880d3ea3c22dbdfdcaa288ac2b60fb1126bb828d (patch)
tree3f9a8c503f7250a4ba931b03aea1e00765fb7543 /library/core/src/alloc
parent837cd9e26c5f741d57c19d4ae35253f26b654a1e (diff)
parentaf9168c467e04c1f67ff88d48735f5f4a6dc5c8c (diff)
downloadrust-880d3ea3c22dbdfdcaa288ac2b60fb1126bb828d.tar.gz
rust-880d3ea3c22dbdfdcaa288ac2b60fb1126bb828d.zip
Rollup merge of #97034 - fee1-dead-contrib:layout-hash, r=dtolnay
Implement `Hash` for `core::alloc::Layout`

This was brought up on [reddit](https://www.reddit.com/r/rust/comments/uoypui/the_standard_library_types_are_good_except_when/), and I don't see why Layout shouldn't implement `Hash`. Feel free to comment if I am wrong though :)
Diffstat (limited to 'library/core/src/alloc')
-rw-r--r--library/core/src/alloc/layout.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs
index cf864039a23..2f378836cbb 100644
--- a/library/core/src/alloc/layout.rs
+++ b/library/core/src/alloc/layout.rs
@@ -26,7 +26,7 @@ const fn size_align<T>() -> (usize, usize) {
 /// like this are met, use specific allocators with looser
 /// requirements, or use the more lenient `Allocator` interface.)
 #[stable(feature = "alloc_layout", since = "1.28.0")]
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
 #[lang = "alloc_layout"]
 pub struct Layout {
     // size of the requested block of memory, measured in bytes.