{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/22600223","id":22600223,"diff_hunk":"@@ -46,8 +43,8 @@\n //!     phone: u64,\n //! }\n //!\n-//! impl Hash for Person {\n-//!     fn hash(&self, state: &mut SipState) {\n+//! impl<H: Hasher + Writer> Hash<H> for Person {","path":"src/libcore/hash/mod.rs","position":35,"original_position":35,"commit_id":"71e522e3a22eca039c7c709d201edd38431d77f7","original_commit_id":"71e522e3a22eca039c7c709d201edd38431d77f7","user":{"login":"aturon","id":709807,"avatar_url":"https://avatars.githubusercontent.com/u/709807?v=3","gravatar_id":"","url":"https://api.github.com/users/aturon","html_url":"https://github.com/aturon","followers_url":"https://api.github.com/users/aturon/followers","following_url":"https://api.github.com/users/aturon/following{/other_user}","gists_url":"https://api.github.com/users/aturon/gists{/gist_id}","starred_url":"https://api.github.com/users/aturon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aturon/subscriptions","organizations_url":"https://api.github.com/users/aturon/orgs","repos_url":"https://api.github.com/users/aturon/repos","events_url":"https://api.github.com/users/aturon/events{/privacy}","received_events_url":"https://api.github.com/users/aturon/received_events","type":"User","site_admin":false},"body":"`Writer` bound no longer needed.","created_at":"2015-01-07T17:24:32Z","updated_at":"2015-01-07T17:24:32Z","html_url":"https://github.com/rust-lang/rust/pull/20654#discussion_r22600223","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/20654","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/22600223"},"html":{"href":"https://github.com/rust-lang/rust/pull/20654#discussion_r22600223"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/20654"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/20654","id":26908017,"html_url":"https://github.com/rust-lang/rust/pull/20654","diff_url":"https://github.com/rust-lang/rust/pull/20654.diff","patch_url":"https://github.com/rust-lang/rust/pull/20654.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/20654","number":20654,"state":"open","locked":false,"title":"std: Stabilize the std::hash module","user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"body":"This commit aims to prepare the `std::hash` module for alpha by formalizing its\r\ncurrent interface whileholding off on adding `#[stable]` to the new APIs.  The\r\ncurrent usage with the `HashMap` and `HashSet` types is also reconciled by\r\nseparating out composable parts of the design. The primary goal of this slight\r\nredesign is to separate the concepts of a hasher's state from a hashing\r\nalgorithm itself.\r\n\r\nThe primary change of this commit is to separate the `Hasher` trait into a\r\n`Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was\r\nactually just a factory for various states, but hashing had very little control\r\nover how these states were used. Additionally the old `Hasher` trait was\r\nactually fairly unrelated to hashing.\r\n\r\nThis commit redesigns the existing `Hasher` trait to match what the notion of a\r\n`Hasher` normally implies with the following definition:\r\n\r\n    trait Hasher {\r\n        type Output;\r\n        fn reset(&mut self);\r\n        fn finish(&self) -> Output;\r\n    }\r\n\r\nThis `Hasher` trait emphasizes that hashing algorithms may produce outputs other\r\nthan a `u64`, so the output type is made generic. Other than that, however, very\r\nlittle is assumed about a particular hasher. It is left up to implementors to\r\nprovide specific methods or trait implementations to feed data into a hasher.\r\n\r\nThe corresponding `Hash` trait becomes:\r\n\r\n    trait Hash<H: Hasher> {\r\n        fn hash(&self, &mut H);\r\n    }\r\n\r\nThe old default of `SipState` was removed from this trait as it's not something\r\nthat we're willing to stabilize until the end of time, but the type parameter is\r\nalways required to implement `Hasher`. Note that the type parameter `H` remains\r\non the trait to enable multidispatch for specialization of hashing for\r\nparticular hashers.\r\n\r\nNote that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is\r\nsimply used as part `derive` and the implementations for all primitive types.\r\n\r\nWith these definitions, the old `Hasher` trait is realized as a new `HashState`\r\ntrait in the `collections::hash_state` module as an unstable addition for\r\nnow. The current definition looks like:\r\n\r\n    trait HashState {\r\n        type Hasher: Hasher;\r\n        fn hasher(&self) -> Hasher;\r\n    }\r\n\r\nThe purpose of this trait is to emphasize that the one piece of functionality\r\nfor implementors is that new instances of `Hasher` can be created.  This\r\nconceptually represents the two keys from which more instances of a\r\n`SipHasher` can be created, and a `HashState` is what's stored in a\r\n`HashMap`, not a `Hasher`.\r\n\r\nImplementors of custom hash algorithms should implement the `Hasher` trait, and\r\nonly hash algorithms intended for use in hash maps need to implement or worry\r\nabout the `HashState` trait.\r\n\r\nThe entire module and `HashState` infrastructure remains `#[unstable]` due to it\r\nbeing recently redesigned, but some other stability decision made for the\r\n`std::hash` module are:\r\n\r\n* The `Writer` trait remains `#[experimental]` as it's intended to be replaced\r\n  with an `io::Writer` (more details soon).\r\n* The top-level `hash` function is `#[unstable]` as it is intended to be generic\r\n  over the hashing algorithm instead of hardwired to `SipHasher`\r\n* The inner `sip` module is now private as its one export, `SipHasher` is\r\n  reexported in the `hash` module.\r\n\r\nAnd finally, a few changes were made to the default parameters on `HashMap`.\r\n\r\n* The `RandomSipHasher` default type parameter was renamed to `RandomState`.\r\n  This renaming emphasizes that it is not a hasher, but rather just state to\r\n  generate hashers. It also moves away from the name \"sip\" as it may not always\r\n  be implemented as `SipHasher`. This type lives in the\r\n  `std::collections::hash_map` module as `#[unstable]`\r\n\r\n* The associated `Hasher` type of `RandomState` is creatively called...\r\n  `Hasher`! This concrete structure lives next to `RandomState` as an\r\n  implemenation of the \"default hashing algorithm\" used for a `HashMap`. Under\r\n  the hood this is currently implemented as `SipHasher`, but it draws an\r\n  explicit interface for now and allows us to modify the implementation over\r\n  time if necessary.\r\n\r\nThere are many breaking changes outlined above, and as a result this commit is\r\na:\r\n\r\n[breaking-change]","created_at":"2015-01-06T18:37:20Z","updated_at":"2015-01-07T17:24:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"776da9d34978aa6b36d0fec3f2e0663974707663","assignee":{"login":"aturon","id":709807,"avatar_url":"https://avatars.githubusercontent.com/u/709807?v=3","gravatar_id":"","url":"https://api.github.com/users/aturon","html_url":"https://github.com/aturon","followers_url":"https://api.github.com/users/aturon/followers","following_url":"https://api.github.com/users/aturon/following{/other_user}","gists_url":"https://api.github.com/users/aturon/gists{/gist_id}","starred_url":"https://api.github.com/users/aturon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aturon/subscriptions","organizations_url":"https://api.github.com/users/aturon/orgs","repos_url":"https://api.github.com/users/aturon/repos","events_url":"https://api.github.com/users/aturon/events{/privacy}","received_events_url":"https://api.github.com/users/aturon/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/20654/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/20654/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/20654/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/71e522e3a22eca039c7c709d201edd38431d77f7","head":{"label":"alexcrichton:stabilize-hash","ref":"stabilize-hash","sha":"71e522e3a22eca039c7c709d201edd38431d77f7","user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"repo":{"id":7385331,"name":"rust","full_name":"alexcrichton/rust","owner":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexcrichton/rust","description":"a safe, concurrent, practical language","fork":true,"url":"https://api.github.com/repos/alexcrichton/rust","forks_url":"https://api.github.com/repos/alexcrichton/rust/forks","keys_url":"https://api.github.com/repos/alexcrichton/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexcrichton/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexcrichton/rust/teams","hooks_url":"https://api.github.com/repos/alexcrichton/rust/hooks","issue_events_url":"https://api.github.com/repos/alexcrichton/rust/issues/events{/number}","events_url":"https://api.github.com/repos/alexcrichton/rust/events","assignees_url":"https://api.github.com/repos/alexcrichton/rust/assignees{/user}","branches_url":"https://api.github.com/repos/alexcrichton/rust/branches{/branch}","tags_url":"https://api.github.com/repos/alexcrichton/rust/tags","blobs_url":"https://api.github.com/repos/alexcrichton/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexcrichton/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexcrichton/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexcrichton/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexcrichton/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/alexcrichton/rust/languages","stargazers_url":"https://api.github.com/repos/alexcrichton/rust/stargazers","contributors_url":"https://api.github.com/repos/alexcrichton/rust/contributors","subscribers_url":"https://api.github.com/repos/alexcrichton/rust/subscribers","subscription_url":"https://api.github.com/repos/alexcrichton/rust/subscription","commits_url":"https://api.github.com/repos/alexcrichton/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexcrichton/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexcrichton/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexcrichton/rust/issues/comments/{number}","contents_url":"https://api.github.com/repos/alexcrichton/rust/contents/{+path}","compare_url":"https://api.github.com/repos/alexcrichton/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexcrichton/rust/merges","archive_url":"https://api.github.com/repos/alexcrichton/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexcrichton/rust/downloads","issues_url":"https://api.github.com/repos/alexcrichton/rust/issues{/number}","pulls_url":"https://api.github.com/repos/alexcrichton/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/alexcrichton/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/alexcrichton/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexcrichton/rust/labels{/name}","releases_url":"https://api.github.com/repos/alexcrichton/rust/releases{/id}","created_at":"2012-12-31T08:59:51Z","updated_at":"2014-12-22T16:32:12Z","pushed_at":"2015-01-07T09:06:31Z","git_url":"git://github.com/alexcrichton/rust.git","ssh_url":"git@github.com:alexcrichton/rust.git","clone_url":"https://github.com/alexcrichton/rust.git","svn_url":"https://github.com/alexcrichton/rust","homepage":"http://www.rust-lang.org","size":220634,"stargazers_count":1,"watchers_count":1,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"incoming"}},"base":{"label":"rust-lang:master","ref":"master","sha":"9e4e524e0eb17c8f463e731f23b544003e8709c6","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust","description":"a safe, concurrent, practical language","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments/{number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","created_at":"2010-06-16T20:39:03Z","updated_at":"2015-01-07T17:03:26Z","pushed_at":"2015-01-07T15:35:36Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"http://www.rust-lang.org","size":419287,"stargazers_count":8341,"watchers_count":8341,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1623,"mirror_url":null,"open_issues_count":2317,"forks":1623,"open_issues":2317,"watchers":8341,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/20654"},"html":{"href":"https://github.com/rust-lang/rust/pull/20654"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/20654"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/20654/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/20654/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/20654/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/71e522e3a22eca039c7c709d201edd38431d77f7"}}}}