{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/140193048","pull_request_review_id":64227896,"id":140193048,"diff_hunk":"@@ -837,6 +832,47 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {\n         }\n         err\n     }\n+\n+    fn report_closure_arg_mismatch(&self,\n+                           span: Span,\n+                           found_span: Option<Span>,\n+                           expected_ref: ty::PolyTraitRef<'tcx>,\n+                           found: ty::PolyTraitRef<'tcx>)\n+        -> DiagnosticBuilder<'tcx>\n+    {\n+        fn build_args_type_string(trait_ref: &ty::TraitRef) -> String {\n+            match trait_ref.substs.type_at(1).sty {\n+                ty::TyTuple(args, _) => {\n+                    let len = args.len();\n+                    if len == 0 {\n+                        return String::from(\"no arguments\");","path":"src/librustc/traits/error_reporting.rs","position":83,"original_position":83,"commit_id":"db0ab7feb30b1813810b2e987d6c8e6086fb7037","original_commit_id":"db0ab7feb30b1813810b2e987d6c8e6086fb7037","user":{"login":"arielb1","id":1830974,"avatar_url":"https://avatars1.githubusercontent.com/u/1830974?v=4","gravatar_id":"","url":"https://api.github.com/users/arielb1","html_url":"https://github.com/arielb1","followers_url":"https://api.github.com/users/arielb1/followers","following_url":"https://api.github.com/users/arielb1/following{/other_user}","gists_url":"https://api.github.com/users/arielb1/gists{/gist_id}","starred_url":"https://api.github.com/users/arielb1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arielb1/subscriptions","organizations_url":"https://api.github.com/users/arielb1/orgs","repos_url":"https://api.github.com/users/arielb1/repos","events_url":"https://api.github.com/users/arielb1/events{/privacy}","received_events_url":"https://api.github.com/users/arielb1/received_events","type":"User","site_admin":false},"body":"ok I see","created_at":"2017-09-21T09:33:27Z","updated_at":"2017-09-21T09:33:27Z","html_url":"https://github.com/rust-lang/rust/pull/44735#discussion_r140193048","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/44735","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/140193048"},"html":{"href":"https://github.com/rust-lang/rust/pull/44735#discussion_r140193048"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/44735"}},"in_reply_to_id":140190886},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/44735","id":142293794,"html_url":"https://github.com/rust-lang/rust/pull/44735","diff_url":"https://github.com/rust-lang/rust/pull/44735.diff","patch_url":"https://github.com/rust-lang/rust/pull/44735.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/44735","number":44735,"state":"open","locked":false,"title":"Friendlier error message for closure argument type mismatch","user":{"login":"tirr-c","id":2322996,"avatar_url":"https://avatars1.githubusercontent.com/u/2322996?v=4","gravatar_id":"","url":"https://api.github.com/users/tirr-c","html_url":"https://github.com/tirr-c","followers_url":"https://api.github.com/users/tirr-c/followers","following_url":"https://api.github.com/users/tirr-c/following{/other_user}","gists_url":"https://api.github.com/users/tirr-c/gists{/gist_id}","starred_url":"https://api.github.com/users/tirr-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tirr-c/subscriptions","organizations_url":"https://api.github.com/users/tirr-c/orgs","repos_url":"https://api.github.com/users/tirr-c/repos","events_url":"https://api.github.com/users/tirr-c/events{/privacy}","received_events_url":"https://api.github.com/users/tirr-c/received_events","type":"User","site_admin":false},"body":"Rebased #42270.\r\nFixes #42143.\r\n\r\n---\r\n\r\n`test.rs`:\r\n\r\n```rust\r\nfn main() {\r\n    foo(|_: i32, _: usize| ());\r\n}\r\n\r\nfn foo<F>(_: F) where F: Fn(&str, usize) {}\r\n```\r\n\r\nBefore:\r\n\r\n```\r\nerror[E0281]: type mismatch: `[closure@test.rs:2:9: 2:30]` implements the trait `std::ops::Fn<(i32, usize)>`, but the trait `for<'r> std::ops::Fn<(&'r str, usize)>` is required\r\n --> test.rs:2:5\r\n  |\r\n2 |     foo(|_: i32, _: usize| ());\r\n  |     ^^^ --------------------- implements `std::ops::Fn<(i32, usize)>`\r\n  |     |\r\n  |     expected &str, found i32\r\n  |     requires `for<'r> std::ops::Fn<(&'r str, usize)>`\r\n  |\r\n  = note: required by `foo`\r\n```\r\n\r\nAfter:\r\n\r\n```\r\nerror[E0631]: type mismatch in closure arguments\r\n --> test.rs:2:5\r\n  |\r\n2 |     foo(|_: i32, _: usize| ());\r\n  |     ^^^ --------------------- takes arguments of type `i32` and `usize`\r\n  |     |\r\n  |     expected arguments of type `&str` and `usize`\r\n  |\r\n  = note: required by `foo`\r\n```\r\n\r\nCompiler output has been changed, and a few tests are failing. Help me writing/fixing tests!\r\n\r\nr? @nikomatsakis ","created_at":"2017-09-21T09:18:29Z","updated_at":"2017-09-21T09:33:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cddbf5a89036df04d2b41f4d88e2dbb9bf5a4a5d","assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"assignees":[{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/44735/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/44735/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/44735/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/db0ab7feb30b1813810b2e987d6c8e6086fb7037","head":{"label":"tirr-c:issue-42143","ref":"issue-42143","sha":"db0ab7feb30b1813810b2e987d6c8e6086fb7037","user":{"login":"tirr-c","id":2322996,"avatar_url":"https://avatars1.githubusercontent.com/u/2322996?v=4","gravatar_id":"","url":"https://api.github.com/users/tirr-c","html_url":"https://github.com/tirr-c","followers_url":"https://api.github.com/users/tirr-c/followers","following_url":"https://api.github.com/users/tirr-c/following{/other_user}","gists_url":"https://api.github.com/users/tirr-c/gists{/gist_id}","starred_url":"https://api.github.com/users/tirr-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tirr-c/subscriptions","organizations_url":"https://api.github.com/users/tirr-c/orgs","repos_url":"https://api.github.com/users/tirr-c/repos","events_url":"https://api.github.com/users/tirr-c/events{/privacy}","received_events_url":"https://api.github.com/users/tirr-c/received_events","type":"User","site_admin":false},"repo":{"id":94109224,"name":"rust","full_name":"tirr-c/rust","owner":{"login":"tirr-c","id":2322996,"avatar_url":"https://avatars1.githubusercontent.com/u/2322996?v=4","gravatar_id":"","url":"https://api.github.com/users/tirr-c","html_url":"https://github.com/tirr-c","followers_url":"https://api.github.com/users/tirr-c/followers","following_url":"https://api.github.com/users/tirr-c/following{/other_user}","gists_url":"https://api.github.com/users/tirr-c/gists{/gist_id}","starred_url":"https://api.github.com/users/tirr-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tirr-c/subscriptions","organizations_url":"https://api.github.com/users/tirr-c/orgs","repos_url":"https://api.github.com/users/tirr-c/repos","events_url":"https://api.github.com/users/tirr-c/events{/privacy}","received_events_url":"https://api.github.com/users/tirr-c/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tirr-c/rust","description":"A safe, concurrent, practical language.","fork":true,"url":"https://api.github.com/repos/tirr-c/rust","forks_url":"https://api.github.com/repos/tirr-c/rust/forks","keys_url":"https://api.github.com/repos/tirr-c/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tirr-c/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tirr-c/rust/teams","hooks_url":"https://api.github.com/repos/tirr-c/rust/hooks","issue_events_url":"https://api.github.com/repos/tirr-c/rust/issues/events{/number}","events_url":"https://api.github.com/repos/tirr-c/rust/events","assignees_url":"https://api.github.com/repos/tirr-c/rust/assignees{/user}","branches_url":"https://api.github.com/repos/tirr-c/rust/branches{/branch}","tags_url":"https://api.github.com/repos/tirr-c/rust/tags","blobs_url":"https://api.github.com/repos/tirr-c/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tirr-c/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tirr-c/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/tirr-c/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tirr-c/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/tirr-c/rust/languages","stargazers_url":"https://api.github.com/repos/tirr-c/rust/stargazers","contributors_url":"https://api.github.com/repos/tirr-c/rust/contributors","subscribers_url":"https://api.github.com/repos/tirr-c/rust/subscribers","subscription_url":"https://api.github.com/repos/tirr-c/rust/subscription","commits_url":"https://api.github.com/repos/tirr-c/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/tirr-c/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/tirr-c/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/tirr-c/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/tirr-c/rust/contents/{+path}","compare_url":"https://api.github.com/repos/tirr-c/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tirr-c/rust/merges","archive_url":"https://api.github.com/repos/tirr-c/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tirr-c/rust/downloads","issues_url":"https://api.github.com/repos/tirr-c/rust/issues{/number}","pulls_url":"https://api.github.com/repos/tirr-c/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/tirr-c/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/tirr-c/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tirr-c/rust/labels{/name}","releases_url":"https://api.github.com/repos/tirr-c/rust/releases{/id}","deployments_url":"https://api.github.com/repos/tirr-c/rust/deployments","created_at":"2017-06-12T15:04:04Z","updated_at":"2017-06-12T15:04:28Z","pushed_at":"2017-09-21T07:57:54Z","git_url":"git://github.com/tirr-c/rust.git","ssh_url":"git@github.com:tirr-c/rust.git","clone_url":"https://github.com/tirr-c/rust.git","svn_url":"https://github.com/tirr-c/rust","homepage":"https://www.rust-lang.org","size":326044,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"e2504cfc7615b9247d4546672e31a9803f4b88ba","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":724712,"name":"rust","full_name":"rust-lang/rust","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/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}","deployments_url":"https://api.github.com/repos/rust-lang/rust/deployments","created_at":"2010-06-16T20:39:03Z","updated_at":"2017-09-21T07:13:31Z","pushed_at":"2017-09-21T09:18:30Z","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":"https://www.rust-lang.org","size":326426,"stargazers_count":23499,"watchers_count":23499,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4321,"mirror_url":null,"open_issues_count":2842,"forks":4321,"open_issues":2842,"watchers":23499,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/44735"},"html":{"href":"https://github.com/rust-lang/rust/pull/44735"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/44735"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/44735/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/44735/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/44735/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/db0ab7feb30b1813810b2e987d6c8e6086fb7037"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"arielb1"}}