{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/189621528","pull_request_review_id":121833153,"id":189621528,"diff_hunk":"@@ -0,0 +1,238 @@\n+- Feature Name: undo-universal-impl-trait\n+- Start Date: 2018-05-21\n+- RFC PR:\n+- Rust Issue:\n+\n+# Summary\n+[summary]: #summary\n+\n+This RFC undoes [RFC 1951], which gave Rust the `impl Trait` syntax in function argument position.\n+\n+# Motivation\n+[motivation]: #motivation\n+\n+## Brief history\n+\n+`impl Trait` was initially introduced in [RFC 1522]. That feature was completely new to Rust as it\n+added a very interesting and powerful feature: being able to provide the caller of a function with a\n+type contract by providing *an anonymized type* in return location of the function and by letting\n+the callee pick the type.\n+\n+    // the caller only knows _properties_ on the returned value, it doesn’t know its real type\n+    fn zero_to_ten() -> impl Iterator<Item = u32>\n+\n+That feature was a complete success and was quickly adopted. The syntax, `impl Trait`, was then\n+quickly refered as “the syntax to pick the type in the callee” and was very simple to get our\n+fingers around. This is a use of *existential quantification* and the single one currently available\n+in Rust. With the right education – and the Rust team made a wonderful job with the book – it’s easy\n+to teach newcomers about the feature.\n+\n+Then came [RFC 1951] and [RFC 2071]. The latter generalizes the use of `impl Trait` to `let`\n+bindings, `const` and `static` declarations and is not of our matter here – because they also act as\n+*existentials*, which is great. However, the former, [RFC 1951], introduced `impl Trait` in argument\n+position. There were a lot of debates about the semantics that the syntax should have but\n+eventually, the consensus came to a decision. The following syntax:\n+\n+    fn foo(x: impl Debug);\n+\n+Is akin to this:\n+\n+    fn foo<T: Debug>(x: T)\n+    fn foo<T>(x: T) where T: Debug\n+\n+And so the feature was stabilized.\n+\n+This RFC wants to undo this.\n+\n+## Why is `impl Trait` in argument position wrong?\n+\n+People out there didn’t really realize what was going on. Complains and confusions on IRC, reddit\n+and the Rust forum started to appear, after the stabilization, by different kind of people –\n+confusion among newcomers, advanced proficient Rustaceans, etc.. Here are some – non-exhaustive –\n+links:\n+\n+  - https://internals.rust-lang.org/t/how-is-impl-display-different-from-foo-t-display-x-t-t/7566/3\n+  - https://www.reddit.com/r/rust/comments/8jfn7z/what_is_the_advantage_of_impl_trait_in_argument/\n+  - https://www.reddit.com/r/rust/comments/8io4q6/impl_trait_is_here_now_what/dyu5dlm/\n+  - https://github.com/rust-lang/rust/issues/44721#issuecomment-330935175\n+\n+[RFC 1951] is organized with *arguments* that we’re basing the current document against.\n+\n+### Argument from learnability\n+\n+> Argument [here](https://github.com/rust-lang/rfcs/blob/master/text/1951-expand-impl-trait.md#argument-from-learnability)\n+\n+This argument explains that people who have an understanding of generics would try to use them in\n+return position for anonymized types (existentials). This argument then stated it’s confusing\n+because the only way to do this with current Rust is to use a complete different mechanism – being\n+`impl Trait`. By contrast, if they have first learned `impl Trait` in argument position, trying to\n+use it in return position *will just work as intended*.\n+\n+This argument is twisted along the lines of subjective opinion about learnability. Rust is a\n+language with a fabulous set of learning resources (the first and most important one being\n+[The Book]). It seems sound to state that **if** people are introduced first to `impl Trait` in\n+argument position, it’s likely that they’ll understand the use in return location. However, what if\n+they don’t want to express it? Existentials in return locations are already a very specific use case\n+of a type system. Having a complete different mechanism is actually a feature, because we are\n+talking about something that has no alternative elsewhere in Rust – i.e. pick the type in the\n+callee. The initial assumption that having a different mechanism is confusing is wrong because\n+`impl Trait` carries its own semantics and because anonymization in return type is not a trivial\n+feature people will use without actually wanting it.\n+\n+Also, people are used to generics. People coming from C++, C#, Java etc. actually know about\n+generics. The links listed above prove how confusing it can get to show them a complete, different\n+way to use generics (`impl Trait` in argument position is a use of hidden generics, that is,\n+anonymized type variables with explicit trait bounds). For people who don’t come from such\n+languages or for completely newcomers, we are assuming that generics are too hard to understand at\n+first but people will eventually need to learn them, as `impl Trait` in argument position is\n+strictly less powerful than type variables and trait bounds. They will have to read the book –\n+perhaps several times. It then confusing to be introduced a concept that is less powerful than\n+generics and yet used in a complete, separate way that has no other alternative (return location).\n+\n+Finally, advanced Rustaceans are also quite confused, because they’ve been using `impl Trait` in\n+return location for a while now (mostly on nightly) and the initial RFC was well accepted among the\n+community and was a success. Those developers obviously mapped `impl Trait` to *callee-picked*\n+types, because at that time it was its sole semantics. When a function with an argument annotated\n+with `impl Trait` appears to such a developer, they get confused because that would mean *an argument\n+which type is chosen by the callee*, which doesn’t quite make sense.\n+\n+### Argument from ergonomics\n+\n+> Argument [here](https://github.com/rust-lang/rfcs/blob/master/text/1951-expand-impl-trait.md#argument-from-ergonomics)\n+\n+In this argument, [RFC 1951] states that having `impl Trait` in argument position eases how our\n+mental model about a function works. We don’t have to read the type variables and rembember their\n+trait bounds anymore to understand the contract of a function.\n+\n+This argument seems sound but again is wrong. Consider:\n+\n+```\n+fn foo<T>(a: T, b: T, c: impl Debug) where T: Add<Output = T> + Copy\n+```\n+\n+This function has three type variables to substitute to be completely monomorphized. However, it’s","path":"text/0000-undo-universal-impl-trait.md","position":113,"original_position":113,"commit_id":"06f5d0dd8d03db53c5d88afb8aeac350e911f9d1","original_commit_id":"06f5d0dd8d03db53c5d88afb8aeac350e911f9d1","user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars2.githubusercontent.com/u/1529387?v=4","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"body":"I think you meant two type variables","created_at":"2018-05-21T15:17:50Z","updated_at":"2018-05-21T15:34:58Z","html_url":"https://github.com/rust-lang/rfcs/pull/2444#discussion_r189621528","pull_request_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments/189621528"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/2444#discussion_r189621528"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444","id":189385244,"html_url":"https://github.com/rust-lang/rfcs/pull/2444","diff_url":"https://github.com/rust-lang/rfcs/pull/2444.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/2444.patch","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2444","number":2444,"state":"open","locked":false,"title":"Add RFC undo-universal-impl-trait.","user":{"login":"phaazon","id":506592,"avatar_url":"https://avatars3.githubusercontent.com/u/506592?v=4","gravatar_id":"","url":"https://api.github.com/users/phaazon","html_url":"https://github.com/phaazon","followers_url":"https://api.github.com/users/phaazon/followers","following_url":"https://api.github.com/users/phaazon/following{/other_user}","gists_url":"https://api.github.com/users/phaazon/gists{/gist_id}","starred_url":"https://api.github.com/users/phaazon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phaazon/subscriptions","organizations_url":"https://api.github.com/users/phaazon/orgs","repos_url":"https://api.github.com/users/phaazon/repos","events_url":"https://api.github.com/users/phaazon/events{/privacy}","received_events_url":"https://api.github.com/users/phaazon/received_events","type":"User","site_admin":false},"body":"[Rendered](https://github.com/phaazon/rfcs/blob/undo-universal-impl-trait/text/0000-undo-universal-impl-trait.md)","created_at":"2018-05-21T13:52:11Z","updated_at":"2018-05-21T15:34:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db8f69158c1777419aa5fec46785d37d04e78332","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/2444/comments","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/06f5d0dd8d03db53c5d88afb8aeac350e911f9d1","head":{"label":"phaazon:undo-universal-impl-trait","ref":"undo-universal-impl-trait","sha":"06f5d0dd8d03db53c5d88afb8aeac350e911f9d1","user":{"login":"phaazon","id":506592,"avatar_url":"https://avatars3.githubusercontent.com/u/506592?v=4","gravatar_id":"","url":"https://api.github.com/users/phaazon","html_url":"https://github.com/phaazon","followers_url":"https://api.github.com/users/phaazon/followers","following_url":"https://api.github.com/users/phaazon/following{/other_user}","gists_url":"https://api.github.com/users/phaazon/gists{/gist_id}","starred_url":"https://api.github.com/users/phaazon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phaazon/subscriptions","organizations_url":"https://api.github.com/users/phaazon/orgs","repos_url":"https://api.github.com/users/phaazon/repos","events_url":"https://api.github.com/users/phaazon/events{/privacy}","received_events_url":"https://api.github.com/users/phaazon/received_events","type":"User","site_admin":false},"repo":{"id":67034552,"name":"rfcs","full_name":"phaazon/rfcs","owner":{"login":"phaazon","id":506592,"avatar_url":"https://avatars3.githubusercontent.com/u/506592?v=4","gravatar_id":"","url":"https://api.github.com/users/phaazon","html_url":"https://github.com/phaazon","followers_url":"https://api.github.com/users/phaazon/followers","following_url":"https://api.github.com/users/phaazon/following{/other_user}","gists_url":"https://api.github.com/users/phaazon/gists{/gist_id}","starred_url":"https://api.github.com/users/phaazon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phaazon/subscriptions","organizations_url":"https://api.github.com/users/phaazon/orgs","repos_url":"https://api.github.com/users/phaazon/repos","events_url":"https://api.github.com/users/phaazon/events{/privacy}","received_events_url":"https://api.github.com/users/phaazon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phaazon/rfcs","description":"RFCs for changes to Rust","fork":true,"url":"https://api.github.com/repos/phaazon/rfcs","forks_url":"https://api.github.com/repos/phaazon/rfcs/forks","keys_url":"https://api.github.com/repos/phaazon/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phaazon/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phaazon/rfcs/teams","hooks_url":"https://api.github.com/repos/phaazon/rfcs/hooks","issue_events_url":"https://api.github.com/repos/phaazon/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/phaazon/rfcs/events","assignees_url":"https://api.github.com/repos/phaazon/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/phaazon/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/phaazon/rfcs/tags","blobs_url":"https://api.github.com/repos/phaazon/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phaazon/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phaazon/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/phaazon/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phaazon/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/phaazon/rfcs/languages","stargazers_url":"https://api.github.com/repos/phaazon/rfcs/stargazers","contributors_url":"https://api.github.com/repos/phaazon/rfcs/contributors","subscribers_url":"https://api.github.com/repos/phaazon/rfcs/subscribers","subscription_url":"https://api.github.com/repos/phaazon/rfcs/subscription","commits_url":"https://api.github.com/repos/phaazon/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/phaazon/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/phaazon/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/phaazon/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/phaazon/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/phaazon/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phaazon/rfcs/merges","archive_url":"https://api.github.com/repos/phaazon/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phaazon/rfcs/downloads","issues_url":"https://api.github.com/repos/phaazon/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/phaazon/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/phaazon/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/phaazon/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phaazon/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/phaazon/rfcs/releases{/id}","deployments_url":"https://api.github.com/repos/phaazon/rfcs/deployments","created_at":"2016-08-31T12:17:55Z","updated_at":"2018-05-21T13:51:57Z","pushed_at":"2018-05-21T14:29:52Z","git_url":"git://github.com/phaazon/rfcs.git","ssh_url":"git@github.com:phaazon/rfcs.git","clone_url":"https://github.com/phaazon/rfcs.git","svn_url":"https://github.com/phaazon/rfcs","homepage":"","size":5711,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"352abc09af0d2344b7dbd4b97aecce00895ffa63","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","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":17527989,"name":"rfcs","full_name":"rust-lang/rfcs","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","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/rfcs","description":"RFCs for changes to Rust","fork":false,"url":"https://api.github.com/repos/rust-lang/rfcs","forks_url":"https://api.github.com/repos/rust-lang/rfcs/forks","keys_url":"https://api.github.com/repos/rust-lang/rfcs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rfcs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rfcs/teams","hooks_url":"https://api.github.com/repos/rust-lang/rfcs/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rfcs/events","assignees_url":"https://api.github.com/repos/rust-lang/rfcs/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rfcs/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rfcs/tags","blobs_url":"https://api.github.com/repos/rust-lang/rfcs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rfcs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rfcs/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rfcs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rfcs/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rfcs/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rfcs/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rfcs/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rfcs/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rfcs/subscription","commits_url":"https://api.github.com/repos/rust-lang/rfcs/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rfcs/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rfcs/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rfcs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rfcs/merges","archive_url":"https://api.github.com/repos/rust-lang/rfcs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rfcs/downloads","issues_url":"https://api.github.com/repos/rust-lang/rfcs/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rfcs/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rfcs/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rfcs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rfcs/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rfcs/releases{/id}","deployments_url":"https://api.github.com/repos/rust-lang/rfcs/deployments","created_at":"2014-03-07T21:29:00Z","updated_at":"2018-05-21T07:02:53Z","pushed_at":"2018-05-21T14:29:53Z","git_url":"git://github.com/rust-lang/rfcs.git","ssh_url":"git@github.com:rust-lang/rfcs.git","clone_url":"https://github.com/rust-lang/rfcs.git","svn_url":"https://github.com/rust-lang/rfcs","homepage":"http://rust-lang.github.io/rfcs/","size":135247,"stargazers_count":1499,"watchers_count":1499,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":624,"mirror_url":null,"archived":false,"open_issues_count":704,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":624,"open_issues":704,"watchers":1499,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444"},"html":{"href":"https://github.com/rust-lang/rfcs/pull/2444"},"issue":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/2444"},"comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/issues/2444/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rfcs/pulls/2444/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rfcs/statuses/06f5d0dd8d03db53c5d88afb8aeac350e911f9d1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sgrif"}}