{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/60515027","id":60515027,"diff_hunk":"@@ -24,27 +25,15 @@ use std::rc::Rc;\n use term;\n \n pub trait Emitter {\n-    fn emit(&mut self, span: Option<&MultiSpan>, msg: &str, code: Option<&str>, lvl: Level);\n-    fn custom_emit(&mut self, sp: &RenderSpan, msg: &str, lvl: Level);\n+    fn emit(&mut self, span: &MultiSpan, msg: &str, code: Option<&str>, lvl: Level);\n \n     /// Emit a structured diagnostic.\n-    fn emit_struct(&mut self, db: &DiagnosticBuilder) {\n-        self.emit(db.span.as_ref(), &db.message, db.code.as_ref().map(|s| &**s), db.level);\n-        for child in &db.children {\n-            match child.render_span {\n-                Some(ref sp) => self.custom_emit(sp, &child.message, child.level),\n-                None => self.emit(child.span.as_ref(), &child.message, None, child.level),\n-            }\n-        }\n-    }\n+    fn emit_struct(&mut self, db: &DiagnosticBuilder);","path":"src/libsyntax/errors/emitter.rs","position":null,"original_position":26,"commit_id":"f60aebb02952ec270189845bd952acf6340b6288","original_commit_id":"14062505736bb4dee857295b6cb49fef75d36444","user":{"login":"nrc","id":762626,"avatar_url":"https://avatars.githubusercontent.com/u/762626?v=3","gravatar_id":"","url":"https://api.github.com/users/nrc","html_url":"https://github.com/nrc","followers_url":"https://api.github.com/users/nrc/followers","following_url":"https://api.github.com/users/nrc/following{/other_user}","gists_url":"https://api.github.com/users/nrc/gists{/gist_id}","starred_url":"https://api.github.com/users/nrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrc/subscriptions","organizations_url":"https://api.github.com/users/nrc/orgs","repos_url":"https://api.github.com/users/nrc/repos","events_url":"https://api.github.com/users/nrc/events{/privacy}","received_events_url":"https://api.github.com/users/nrc/received_events","type":"User","site_admin":false},"body":"Why can't we have a default implementation for `emit_struct` any more?","created_at":"2016-04-21T01:35:21Z","updated_at":"2016-04-21T01:35:21Z","html_url":"https://github.com/rust-lang/rust/pull/32756#discussion_r60515027","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/32756","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/60515027"},"html":{"href":"https://github.com/rust-lang/rust/pull/32756#discussion_r60515027"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/32756"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/32756","id":65390779,"html_url":"https://github.com/rust-lang/rust/pull/32756","diff_url":"https://github.com/rust-lang/rust/pull/32756.diff","patch_url":"https://github.com/rust-lang/rust/pull/32756.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/32756","number":32756,"state":"open","locked":false,"title":"Overhaul borrowck error messages and compiler error formatting generally","user":{"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},"body":"This is a major overhaul of how the compiler reports errors. The primary goal is to be able to give many spans within the same overall context, such as this:\r\n\r\n```\r\n./borrow-errors.rs:73:17: 73:20: error: cannot borrow `*vec` as immutable because previous closure requires unique access [E0501]\r\n70     let append = |e| {\r\n                    ~~~ closure construction occurs here\r\n71         vec.push(e)\r\n           ~~~ previous borrow occurs due to use of `vec` in closure\r\n72     };\r\n73     let data = &vec[3];\r\n                   ~~~ borrow occurs here\r\n74 }\r\n   ~ borrow from closure ends here\r\n```\r\n\r\nHowever, in the process we made a number of other changes:\r\n\r\n- Removed the repetitive filenames from snippets and just give the line number.\r\n- Color the line numbers blue so they \"fade away\"\r\n- Remove the file name and line number from the error code suggestions since they don't seem to fit anymore. (This should probably happen in more places, like existing notes.)\r\n- Newlines in between errors to help group them better.\r\n\r\nThis PR is not quite ready to land, but we thought it made sense to stop here and get some feedback from people at large. It'd be great if people can check out the branch and play with it. We'd be especially interested in hearing about cases that don't look good with the new formatting (I suspect they exist). \r\n\r\nHere is a checklist of some pending work items for this PR. Some of them may be best left for follow-up PRs:\r\n\r\n- [x] Accommodate multiple files in a `MultiSpan` (this should be easy)\r\n  - In this case, we want to print filenames though.\r\n- [x] Remove duplicate E0500 code.\r\n- [x] Make the header message bold, rather than current hack that makes all errors/warnings bold\r\n- [ ] Update warning text color (yellow is hard to read w/ a white background)\r\n- [ ] New unit testing mechanism that can test colors and precise appearance\r\n\r\nSome changes to the borrow checker messages specifically that may be best left for later:\r\n\r\n- [ ] Identify when you have the same span for multiple borrows in a loop and give a better message\r\n- [ ] Right now, we special case closure captures due to unique loans, but we could give similar treatment to any loan coming through a capture\r\n- [ ] Decide whether to thread the closure header span through the builder API convenience methods\r\n\r\nJoint work with @jonathandturner.\r\n\r\nFixes https://github.com/rust-lang/rust/issues/3533","created_at":"2016-04-05T23:54:20Z","updated_at":"2016-04-21T01:35:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f3c254b5ef8480a04e42a4fbbabec454792c948","assignee":{"login":"nrc","id":762626,"avatar_url":"https://avatars.githubusercontent.com/u/762626?v=3","gravatar_id":"","url":"https://api.github.com/users/nrc","html_url":"https://github.com/nrc","followers_url":"https://api.github.com/users/nrc/followers","following_url":"https://api.github.com/users/nrc/following{/other_user}","gists_url":"https://api.github.com/users/nrc/gists{/gist_id}","starred_url":"https://api.github.com/users/nrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrc/subscriptions","organizations_url":"https://api.github.com/users/nrc/orgs","repos_url":"https://api.github.com/users/nrc/repos","events_url":"https://api.github.com/users/nrc/events{/privacy}","received_events_url":"https://api.github.com/users/nrc/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/32756/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/32756/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/32756/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/f60aebb02952ec270189845bd952acf6340b6288","head":{"label":"nikomatsakis:borrowck-snippet","ref":"borrowck-snippet","sha":"f60aebb02952ec270189845bd952acf6340b6288","user":{"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},"repo":{"id":1672543,"name":"rust","full_name":"nikomatsakis/rust","owner":{"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},"private":false,"html_url":"https://github.com/nikomatsakis/rust","description":"A work-in-progress programming language; not yet suitable for users","fork":true,"url":"https://api.github.com/repos/nikomatsakis/rust","forks_url":"https://api.github.com/repos/nikomatsakis/rust/forks","keys_url":"https://api.github.com/repos/nikomatsakis/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nikomatsakis/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nikomatsakis/rust/teams","hooks_url":"https://api.github.com/repos/nikomatsakis/rust/hooks","issue_events_url":"https://api.github.com/repos/nikomatsakis/rust/issues/events{/number}","events_url":"https://api.github.com/repos/nikomatsakis/rust/events","assignees_url":"https://api.github.com/repos/nikomatsakis/rust/assignees{/user}","branches_url":"https://api.github.com/repos/nikomatsakis/rust/branches{/branch}","tags_url":"https://api.github.com/repos/nikomatsakis/rust/tags","blobs_url":"https://api.github.com/repos/nikomatsakis/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nikomatsakis/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nikomatsakis/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/nikomatsakis/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nikomatsakis/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/nikomatsakis/rust/languages","stargazers_url":"https://api.github.com/repos/nikomatsakis/rust/stargazers","contributors_url":"https://api.github.com/repos/nikomatsakis/rust/contributors","subscribers_url":"https://api.github.com/repos/nikomatsakis/rust/subscribers","subscription_url":"https://api.github.com/repos/nikomatsakis/rust/subscription","commits_url":"https://api.github.com/repos/nikomatsakis/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/nikomatsakis/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/nikomatsakis/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/nikomatsakis/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/nikomatsakis/rust/contents/{+path}","compare_url":"https://api.github.com/repos/nikomatsakis/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nikomatsakis/rust/merges","archive_url":"https://api.github.com/repos/nikomatsakis/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nikomatsakis/rust/downloads","issues_url":"https://api.github.com/repos/nikomatsakis/rust/issues{/number}","pulls_url":"https://api.github.com/repos/nikomatsakis/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/nikomatsakis/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/nikomatsakis/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nikomatsakis/rust/labels{/name}","releases_url":"https://api.github.com/repos/nikomatsakis/rust/releases{/id}","deployments_url":"https://api.github.com/repos/nikomatsakis/rust/deployments","created_at":"2011-04-27T20:20:29Z","updated_at":"2016-03-03T17:02:52Z","pushed_at":"2016-04-21T00:01:44Z","git_url":"git://github.com/nikomatsakis/rust.git","ssh_url":"git@github.com:nikomatsakis/rust.git","clone_url":"https://github.com/nikomatsakis/rust.git","svn_url":"https://github.com/nikomatsakis/rust","homepage":"","size":300039,"stargazers_count":4,"watchers_count":4,"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":4,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"6ece1447f02b2310e5f4c7ef1efd1312476cae80","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-04-21T00:32:07Z","pushed_at":"2016-04-21T01:21:13Z","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":486779,"stargazers_count":16321,"watchers_count":16321,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3115,"mirror_url":null,"open_issues_count":2447,"forks":3115,"open_issues":2447,"watchers":16321,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/32756"},"html":{"href":"https://github.com/rust-lang/rust/pull/32756"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/32756"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/32756/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/32756/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/32756/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/f60aebb02952ec270189845bd952acf6340b6288"}}}}