{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/131549910","pull_request_review_id":54541785,"id":131549910,"diff_hunk":"@@ -39,54 +47,84 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {\n         };\n \n         // Determine whether the sub and sup consist of both anonymous (elided) regions.\n-        let (ty1, ty2) = if self.is_suitable_anonymous_region(sup).is_some() &&\n-                            self.is_suitable_anonymous_region(sub).is_some() {\n+        let (ty1, ty2, first_is_struct, second_is_struct) = if\n+            self.is_suitable_anonymous_region(sup).is_some() &&\n+            self.is_suitable_anonymous_region(sub).is_some() {\n             if let (Some(anon_reg1), Some(anon_reg2)) =\n                 (self.is_suitable_anonymous_region(sup), self.is_suitable_anonymous_region(sub)) {\n                 let ((_, br1), (_, br2)) = (anon_reg1, anon_reg2);\n-                if self.find_anon_type(sup, &br1).is_some() &&\n-                   self.find_anon_type(sub, &br2).is_some() {\n-                    (self.find_anon_type(sup, &br1).unwrap(),\n-                     self.find_anon_type(sub, &br2).unwrap())\n-                } else {\n-                    return false;\n+                let found_arg1 = self.find_anon_type(sup, &br1);\n+                let found_arg2 = self.find_anon_type(sub, &br2);\n+                match (found_arg1, found_arg2) {\n+                    (Some((anonarg_1, is_struct1)), Some((anonarg_2, is_struct2))) => {\n+                        (anonarg_1, anonarg_2, is_struct1, is_struct2)\n+                    }\n+                    _ => {\n+                        return false;\n+                    }\n                 }\n+\n             } else {\n                 return false;\n             }\n         } else {\n-            return false; // inapplicable\n+            return false; //inapplicable\n         };\n \n-        if let (Some(sup_arg), Some(sub_arg)) =\n+        let (label1, label2) = if let (Some(sup_arg), Some(sub_arg)) =\n             (self.find_arg_with_anonymous_region(sup, sup),\n              self.find_arg_with_anonymous_region(sub, sub)) {\n             let ((anon_arg1, _, _, _), (anon_arg2, _, _, _)) = (sup_arg, sub_arg);\n-\n             let span_label_var1 = if let Some(simple_name) = anon_arg1.pat.simple_name() {\n-                format!(\" from `{}` \", simple_name)\n+                format!(\" from `{}`\", simple_name)\n             } else {\n-                format!(\" \")\n+                format!(\"\")\n             };\n \n             let span_label_var2 = if let Some(simple_name) = anon_arg2.pat.simple_name() {\n-                format!(\" into `{}` \", simple_name)\n+                format!(\" into `{}`\", simple_name)\n             } else {\n-                format!(\" \")\n+                format!(\"\")\n             };\n \n+            (span_label_var1, span_label_var2)\n+        } else {\n+            return false;\n+        };\n+\n+        if let Some(error_label) =\n+            self.process_anon_anon_conflict(first_is_struct, second_is_struct) {\n             struct_span_err!(self.tcx.sess, span, E0623, \"lifetime mismatch\")\n                 .span_label(ty1.span,\n-                            format!(\"these references are not declared with the same lifetime...\"))\n+                            format!(\"{} are declared with different lifetimes...\", error_label))\n                 .span_label(ty2.span, format!(\"\"))\n-                .span_label(span,\n-                            format!(\"...but data{}flows{}here\", span_label_var1, span_label_var2))\n+                .span_label(span, format!(\"...but data{} flows{} here\", label1, label2))\n                 .emit();\n+            return true;\n         } else {\n             return false;\n         }\n+    }\n \n-        return true;\n+    // try to pre-process the errors, for the purpose of generating different\n+    // span labels for the different combinations of the two parameters which can be\n+    // either references or structs.\n+    fn process_anon_anon_conflict(&self,\n+                                  is_arg1_struct: bool,\n+                                  is_arg2_struct: bool)\n+                                  -> Option<(String)> {\n+        let arg1_label = {\n+            if is_arg1_struct && is_arg2_struct {\n+                format!(\"these structs\")\n+            } else if is_arg1_struct && !is_arg2_struct {\n+                format!(\"the struct and reference\")\n+            } else if !is_arg1_struct && is_arg2_struct {\n+                format!(\"the reference and the struct\")","path":"src/librustc/infer/error_reporting/anon_anon_conflict.rs","position":117,"original_position":117,"commit_id":"5cf4f2a099039abc0aef843412c7b7f7e3b7284e","original_commit_id":"5cf4f2a099039abc0aef843412c7b7f7e3b7284e","user":{"login":"estebank","id":1606434,"avatar_url":"https://avatars2.githubusercontent.com/u/1606434?v=4","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":"different wording vs line 120","created_at":"2017-08-06T19:01:31Z","updated_at":"2017-08-06T19:09:56Z","html_url":"https://github.com/rust-lang/rust/pull/43700#discussion_r131549910","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/43700","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/131549910"},"html":{"href":"https://github.com/rust-lang/rust/pull/43700#discussion_r131549910"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/43700"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/43700","id":134333512,"html_url":"https://github.com/rust-lang/rust/pull/43700","diff_url":"https://github.com/rust-lang/rust/pull/43700.diff","patch_url":"https://github.com/rust-lang/rust/pull/43700.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/43700","number":43700,"state":"open","locked":false,"title":"Adding E0623 for structs","user":{"login":"gaurikholkar","id":9420877,"avatar_url":"https://avatars1.githubusercontent.com/u/9420877?v=4","gravatar_id":"","url":"https://api.github.com/users/gaurikholkar","html_url":"https://github.com/gaurikholkar","followers_url":"https://api.github.com/users/gaurikholkar/followers","following_url":"https://api.github.com/users/gaurikholkar/following{/other_user}","gists_url":"https://api.github.com/users/gaurikholkar/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurikholkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurikholkar/subscriptions","organizations_url":"https://api.github.com/users/gaurikholkar/orgs","repos_url":"https://api.github.com/users/gaurikholkar/repos","events_url":"https://api.github.com/users/gaurikholkar/events{/privacy}","received_events_url":"https://api.github.com/users/gaurikholkar/received_events","type":"User","site_admin":false},"body":"This is a fix to #43275 \r\n\r\nThe error message is \r\n```\r\n+error[E0623]: lifetime mismatch\r\n+  --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:12\r\n+   |\r\n+14 | fn foo(mut x: Vec<Ref>, y: Ref) {\r\n+   |                   ---      --- these structs are declared with different lifetimes...\r\n+15 |     x.push(y);\r\n+   |            ^ ...but data from `y` flows into `x` here\r\n+\r\n+error: aborting due to previous error\r\n```\r\n\r\nr? @nikomatsakis ","created_at":"2017-08-06T17:15:32Z","updated_at":"2017-08-06T19:09:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9def35e92a633a12d036418a73df1af9cd3a1741","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/43700/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/43700/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/43700/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/5cf4f2a099039abc0aef843412c7b7f7e3b7284e","head":{"label":"gaurikholkar:struct_lifetimes","ref":"struct_lifetimes","sha":"5cf4f2a099039abc0aef843412c7b7f7e3b7284e","user":{"login":"gaurikholkar","id":9420877,"avatar_url":"https://avatars1.githubusercontent.com/u/9420877?v=4","gravatar_id":"","url":"https://api.github.com/users/gaurikholkar","html_url":"https://github.com/gaurikholkar","followers_url":"https://api.github.com/users/gaurikholkar/followers","following_url":"https://api.github.com/users/gaurikholkar/following{/other_user}","gists_url":"https://api.github.com/users/gaurikholkar/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurikholkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurikholkar/subscriptions","organizations_url":"https://api.github.com/users/gaurikholkar/orgs","repos_url":"https://api.github.com/users/gaurikholkar/repos","events_url":"https://api.github.com/users/gaurikholkar/events{/privacy}","received_events_url":"https://api.github.com/users/gaurikholkar/received_events","type":"User","site_admin":false},"repo":{"id":88258655,"name":"rust","full_name":"gaurikholkar/rust","owner":{"login":"gaurikholkar","id":9420877,"avatar_url":"https://avatars1.githubusercontent.com/u/9420877?v=4","gravatar_id":"","url":"https://api.github.com/users/gaurikholkar","html_url":"https://github.com/gaurikholkar","followers_url":"https://api.github.com/users/gaurikholkar/followers","following_url":"https://api.github.com/users/gaurikholkar/following{/other_user}","gists_url":"https://api.github.com/users/gaurikholkar/gists{/gist_id}","starred_url":"https://api.github.com/users/gaurikholkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaurikholkar/subscriptions","organizations_url":"https://api.github.com/users/gaurikholkar/orgs","repos_url":"https://api.github.com/users/gaurikholkar/repos","events_url":"https://api.github.com/users/gaurikholkar/events{/privacy}","received_events_url":"https://api.github.com/users/gaurikholkar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gaurikholkar/rust","description":"A safe, concurrent, practical language.","fork":true,"url":"https://api.github.com/repos/gaurikholkar/rust","forks_url":"https://api.github.com/repos/gaurikholkar/rust/forks","keys_url":"https://api.github.com/repos/gaurikholkar/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gaurikholkar/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gaurikholkar/rust/teams","hooks_url":"https://api.github.com/repos/gaurikholkar/rust/hooks","issue_events_url":"https://api.github.com/repos/gaurikholkar/rust/issues/events{/number}","events_url":"https://api.github.com/repos/gaurikholkar/rust/events","assignees_url":"https://api.github.com/repos/gaurikholkar/rust/assignees{/user}","branches_url":"https://api.github.com/repos/gaurikholkar/rust/branches{/branch}","tags_url":"https://api.github.com/repos/gaurikholkar/rust/tags","blobs_url":"https://api.github.com/repos/gaurikholkar/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gaurikholkar/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gaurikholkar/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/gaurikholkar/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gaurikholkar/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/gaurikholkar/rust/languages","stargazers_url":"https://api.github.com/repos/gaurikholkar/rust/stargazers","contributors_url":"https://api.github.com/repos/gaurikholkar/rust/contributors","subscribers_url":"https://api.github.com/repos/gaurikholkar/rust/subscribers","subscription_url":"https://api.github.com/repos/gaurikholkar/rust/subscription","commits_url":"https://api.github.com/repos/gaurikholkar/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/gaurikholkar/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/gaurikholkar/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/gaurikholkar/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/gaurikholkar/rust/contents/{+path}","compare_url":"https://api.github.com/repos/gaurikholkar/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gaurikholkar/rust/merges","archive_url":"https://api.github.com/repos/gaurikholkar/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gaurikholkar/rust/downloads","issues_url":"https://api.github.com/repos/gaurikholkar/rust/issues{/number}","pulls_url":"https://api.github.com/repos/gaurikholkar/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/gaurikholkar/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/gaurikholkar/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gaurikholkar/rust/labels{/name}","releases_url":"https://api.github.com/repos/gaurikholkar/rust/releases{/id}","deployments_url":"https://api.github.com/repos/gaurikholkar/rust/deployments","created_at":"2017-04-14T10:28:56Z","updated_at":"2017-04-14T10:29:15Z","pushed_at":"2017-08-06T18:36:15Z","git_url":"git://github.com/gaurikholkar/rust.git","ssh_url":"git@github.com:gaurikholkar/rust.git","clone_url":"https://github.com/gaurikholkar/rust.git","svn_url":"https://github.com/gaurikholkar/rust","homepage":"https://www.rust-lang.org","size":319077,"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":"be69520b9ae32c9242207fd5bc97888cd3fc73bf","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-08-06T18:52:02Z","pushed_at":"2017-08-06T18:58:02Z","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":319284,"stargazers_count":22924,"watchers_count":22924,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4216,"mirror_url":null,"open_issues_count":2759,"forks":4216,"open_issues":2759,"watchers":22924,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/43700"},"html":{"href":"https://github.com/rust-lang/rust/pull/43700"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/43700"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/43700/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/43700/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/43700/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/5cf4f2a099039abc0aef843412c7b7f7e3b7284e"}}}}
{"actor":{"display_login":"estebank"}}