{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/77945032","id":77945032,"diff_hunk":"@@ -274,9 +274,20 @@ impl<'a> DiagnosticBuilder<'a> {\n                                found: &fmt::Display)\n                                -> &mut DiagnosticBuilder<'a>\n     {\n+        self.note_expected_found_extra(label, expected, found, &\"\", &\"\")\n+    }\n+\n+    pub fn note_expected_found_extra(&mut self,\n+                                     label: &fmt::Display,\n+                                     expected: &fmt::Display,\n+                                     found: &fmt::Display,\n+                                     expected_extra: &fmt::Display,\n+                                     found_extra: &fmt::Display)\n+                                     -> &mut DiagnosticBuilder<'a>\n+    {\n         // For now, just attach these as notes\n-        self.note(&format!(\"expected {} `{}`\", label, expected));\n-        self.note(&format!(\"   found {} `{}`\", label, found));\n+        self.note(&format!(\"expected {} `{}` {}\", label, expected, expected_extra));\n+        self.note(&format!(\"   found {} `{}` {}\", label, found, found_extra));","path":"src/librustc_errors/lib.rs","position":19,"original_position":19,"commit_id":"f2e2d0c2e393e94b36e94030c54e99c9d467ffb0","original_commit_id":"f2e2d0c2e393e94b36e94030c54e99c9d467ffb0","user":{"login":"TimNN","id":1178249,"avatar_url":"https://avatars.githubusercontent.com/u/1178249?v=3","gravatar_id":"","url":"https://api.github.com/users/TimNN","html_url":"https://github.com/TimNN","followers_url":"https://api.github.com/users/TimNN/followers","following_url":"https://api.github.com/users/TimNN/following{/other_user}","gists_url":"https://api.github.com/users/TimNN/gists{/gist_id}","starred_url":"https://api.github.com/users/TimNN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimNN/subscriptions","organizations_url":"https://api.github.com/users/TimNN/orgs","repos_url":"https://api.github.com/users/TimNN/repos","events_url":"https://api.github.com/users/TimNN/events{/privacy}","received_events_url":"https://api.github.com/users/TimNN/received_events","type":"User","site_admin":false},"body":"I think it would be preferable to move the added spaces to the `_extra` variables, so that there isn't any trailing space in case the `_extra` variables are empty.\r\n\r\nThat should also fix the current three ui test failures. ","created_at":"2016-09-08T04:39:59Z","updated_at":"2016-09-08T04:39:59Z","html_url":"https://github.com/rust-lang/rust/pull/36338#discussion_r77945032","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/36338","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/77945032"},"html":{"href":"https://github.com/rust-lang/rust/pull/36338#discussion_r77945032"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/36338"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/36338","id":84401844,"html_url":"https://github.com/rust-lang/rust/pull/36338","diff_url":"https://github.com/rust-lang/rust/pull/36338.diff","patch_url":"https://github.com/rust-lang/rust/pull/36338.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/36338","number":36338,"state":"open","locked":false,"title":"Be more specific when type parameter shadows primitive type","user":{"login":"estebank","id":1606434,"avatar_url":"https://avatars.githubusercontent.com/u/1606434?v=3","gravatar_id":"","url":"https://api.github.com/users/estebank","html_url":"https://github.com/estebank","followers_url":"https://api.github.com/users/estebank/followers","following_url":"https://api.github.com/users/estebank/following{/other_user}","gists_url":"https://api.github.com/users/estebank/gists{/gist_id}","starred_url":"https://api.github.com/users/estebank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estebank/subscriptions","organizations_url":"https://api.github.com/users/estebank/orgs","repos_url":"https://api.github.com/users/estebank/repos","events_url":"https://api.github.com/users/estebank/events{/privacy}","received_events_url":"https://api.github.com/users/estebank/received_events","type":"User","site_admin":false},"body":"When a type parameter shadows a primitive type, the error message\r\nwas non obvious. For example, given the file `file.rs`:\r\n\r\n```rust\r\ntrait Parser<T> {\r\n    fn parse(text: &str) -> Option<T>;\r\n}\r\n\r\nimpl<bool> Parser<bool> for bool {\r\n    fn parse(text: &str) -> Option<bool> {\r\n        Some(true)\r\n    }\r\n}\r\n\r\nfn main() {\r\n    println!(\"{}\", bool::parse(\"ok\").unwrap_or(false));\r\n}\r\n```\r\n\r\nThe output was:\r\n\r\n```bash\r\n% rustc file.rs\r\nerror[E0308]: mismatched types\r\n --> file.rs:7:14\r\n  |\r\n7 |         Some(true)\r\n  |              ^^^^ expected type parameter, found bool a\r\n  |\r\n  = note: expected type `bool`\r\n  = note:    found type `bool`\r\n\r\nerror: aborting due to previous error\r\n```\r\n\r\nWe now show extra information about the type:\r\n\r\n```bash\r\n% rustc file.rs\r\nerror[E0308]: mismatched types\r\n --> file.rs:7:14\r\n  |\r\n7 |         Some(true)\r\n  |              ^^^^ expected type parameter, found bool a\r\n  |\r\n  = note: expected type `bool` (type parameter)\r\n  = note:    found type `bool` (bool)\r\n\r\nerror: aborting due to previous error\r\n```\r\n\r\nFixes #35030","created_at":"2016-09-08T01:44:15Z","updated_at":"2016-09-08T04:39:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc7d7dbbb29573d5dfc7b6c6ac9f9cf801c20d30","assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars.githubusercontent.com/u/155238?v=3","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://avatars.githubusercontent.com/u/155238?v=3","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}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/36338/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/36338/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/36338/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/f2e2d0c2e393e94b36e94030c54e99c9d467ffb0","head":{"label":"estebank:primitive-shadow","ref":"primitive-shadow","sha":"f2e2d0c2e393e94b36e94030c54e99c9d467ffb0","user":{"login":"estebank","id":1606434,"avatar_url":"https://avatars.githubusercontent.com/u/1606434?v=3","gravatar_id":"","url":"https://api.github.com/users/estebank","html_url":"https://github.com/estebank","followers_url":"https://api.github.com/users/estebank/followers","following_url":"https://api.github.com/users/estebank/following{/other_user}","gists_url":"https://api.github.com/users/estebank/gists{/gist_id}","starred_url":"https://api.github.com/users/estebank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estebank/subscriptions","organizations_url":"https://api.github.com/users/estebank/orgs","repos_url":"https://api.github.com/users/estebank/repos","events_url":"https://api.github.com/users/estebank/events{/privacy}","received_events_url":"https://api.github.com/users/estebank/received_events","type":"User","site_admin":false},"repo":{"id":59872990,"name":"rust","full_name":"estebank/rust","owner":{"login":"estebank","id":1606434,"avatar_url":"https://avatars.githubusercontent.com/u/1606434?v=3","gravatar_id":"","url":"https://api.github.com/users/estebank","html_url":"https://github.com/estebank","followers_url":"https://api.github.com/users/estebank/followers","following_url":"https://api.github.com/users/estebank/following{/other_user}","gists_url":"https://api.github.com/users/estebank/gists{/gist_id}","starred_url":"https://api.github.com/users/estebank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/estebank/subscriptions","organizations_url":"https://api.github.com/users/estebank/orgs","repos_url":"https://api.github.com/users/estebank/repos","events_url":"https://api.github.com/users/estebank/events{/privacy}","received_events_url":"https://api.github.com/users/estebank/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/estebank/rust","description":"A safe, concurrent, practical language.","fork":true,"url":"https://api.github.com/repos/estebank/rust","forks_url":"https://api.github.com/repos/estebank/rust/forks","keys_url":"https://api.github.com/repos/estebank/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/estebank/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/estebank/rust/teams","hooks_url":"https://api.github.com/repos/estebank/rust/hooks","issue_events_url":"https://api.github.com/repos/estebank/rust/issues/events{/number}","events_url":"https://api.github.com/repos/estebank/rust/events","assignees_url":"https://api.github.com/repos/estebank/rust/assignees{/user}","branches_url":"https://api.github.com/repos/estebank/rust/branches{/branch}","tags_url":"https://api.github.com/repos/estebank/rust/tags","blobs_url":"https://api.github.com/repos/estebank/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/estebank/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/estebank/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/estebank/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/estebank/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/estebank/rust/languages","stargazers_url":"https://api.github.com/repos/estebank/rust/stargazers","contributors_url":"https://api.github.com/repos/estebank/rust/contributors","subscribers_url":"https://api.github.com/repos/estebank/rust/subscribers","subscription_url":"https://api.github.com/repos/estebank/rust/subscription","commits_url":"https://api.github.com/repos/estebank/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/estebank/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/estebank/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/estebank/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/estebank/rust/contents/{+path}","compare_url":"https://api.github.com/repos/estebank/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/estebank/rust/merges","archive_url":"https://api.github.com/repos/estebank/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/estebank/rust/downloads","issues_url":"https://api.github.com/repos/estebank/rust/issues{/number}","pulls_url":"https://api.github.com/repos/estebank/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/estebank/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/estebank/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/estebank/rust/labels{/name}","releases_url":"https://api.github.com/repos/estebank/rust/releases{/id}","deployments_url":"https://api.github.com/repos/estebank/rust/deployments","created_at":"2016-05-28T02:09:15Z","updated_at":"2016-05-28T02:09:33Z","pushed_at":"2016-09-08T01:42:50Z","git_url":"git://github.com/estebank/rust.git","ssh_url":"git@github.com:estebank/rust.git","clone_url":"https://github.com/estebank/rust.git","svn_url":"https://github.com/estebank/rust","homepage":"https://www.rust-lang.org","size":299457,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"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":"9627e9ef6e0183e50b6a985143d31d82bda31cfe","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}","deployments_url":"https://api.github.com/repos/rust-lang/rust/deployments","created_at":"2010-06-16T20:39:03Z","updated_at":"2016-09-08T03:50:44Z","pushed_at":"2016-09-08T04:08:15Z","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":509860,"stargazers_count":18200,"watchers_count":18200,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3516,"mirror_url":null,"open_issues_count":2787,"forks":3516,"open_issues":2787,"watchers":18200,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/36338"},"html":{"href":"https://github.com/rust-lang/rust/pull/36338"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/36338"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/36338/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/36338/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/36338/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/f2e2d0c2e393e94b36e94030c54e99c9d467ffb0"}}}}
{"actor":{"display_login":"TimNN"}}