{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/88322006","pull_request_review_id":8899407,"id":88322006,"diff_hunk":"@@ -437,8 +446,42 @@ impl<'a> LoweringContext<'a> {\n     }\n \n     fn lower_generics(&mut self, g: &Generics) -> hir::Generics {\n+        // Collect `?Trait` bounds in where clause and move them to parameter definitions.\n+        let mut add_bounds = NodeMap();\n+        for pred in &g.where_clause.predicates {\n+            if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {\n+                'next_bound: for bound in &bound_pred.bounds {\n+                    if let TraitTyParamBound(_, TraitBoundModifier::Maybe) = *bound {\n+                        let report_error = || {\n+                            self.diagnostic().span_err(bound_pred.bounded_ty.span,\n+                                \"`?Trait` bounds are permitted only on fresh type parameters\");\n+                        };\n+                        // Check if the where clause type is a plain type parameter.\n+                        match bound_pred.bounded_ty.node {\n+                            TyKind::Path(None, ref path)\n+                                    if !path.global && path.segments.len() == 1 &&\n+                                        bound_pred.bound_lifetimes.is_empty() => {\n+                                let name = path.segments[0].identifier.name;\n+                                for ty_param in &g.ty_params {\n+                                    // Don't bother looking up the definition,","path":"src/librustc/hir/lowering.rs","position":68,"original_position":68,"commit_id":"3e5802db196f1ed3bd0327605c603f57cf069fca","original_commit_id":"3e5802db196f1ed3bd0327605c603f57cf069fca","user":{"login":"arielb1","id":1830974,"avatar_url":"https://avatars.githubusercontent.com/u/1830974?v=3","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":"Sure. Randomly implementing unhygienic lookup is a sure way to cause bugs in the future.","created_at":"2016-11-16T20:17:17Z","updated_at":"2016-11-16T20:17:17Z","html_url":"https://github.com/rust-lang/rust/pull/37791#discussion_r88322006","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/37791","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/88322006"},"html":{"href":"https://github.com/rust-lang/rust/pull/37791#discussion_r88322006"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/37791"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/37791","id":93879058,"html_url":"https://github.com/rust-lang/rust/pull/37791","diff_url":"https://github.com/rust-lang/rust/pull/37791.diff","patch_url":"https://github.com/rust-lang/rust/pull/37791.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/37791","number":37791,"state":"open","locked":false,"title":"Support `?Sized` in where clauses","user":{"login":"petrochenkov","id":5751617,"avatar_url":"https://avatars.githubusercontent.com/u/5751617?v=3","gravatar_id":"","url":"https://api.github.com/users/petrochenkov","html_url":"https://github.com/petrochenkov","followers_url":"https://api.github.com/users/petrochenkov/followers","following_url":"https://api.github.com/users/petrochenkov/following{/other_user}","gists_url":"https://api.github.com/users/petrochenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/petrochenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrochenkov/subscriptions","organizations_url":"https://api.github.com/users/petrochenkov/orgs","repos_url":"https://api.github.com/users/petrochenkov/repos","events_url":"https://api.github.com/users/petrochenkov/events{/privacy}","received_events_url":"https://api.github.com/users/petrochenkov/received_events","type":"User","site_admin":false},"body":"Implemented as described in https://github.com/rust-lang/rust/issues/20503#issuecomment-258677026 - `?Trait` bounds are moved on type parameter definitions when possible, reported as errors otherwise.\r\n(It'd be nice to unify bounds and where clauses in HIR, but this is mostly blocked by rustdoc now - it needs to render bounds in pleasant way and the best way to do it so far is to mirror what was written in source code.)\r\n\r\nFixes https://github.com/rust-lang/rust/issues/20503\r\nr? @nikomatsakis ","created_at":"2016-11-16T00:33:13Z","updated_at":"2016-11-16T20:17:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61f4145fca0b0e0805ae17d3357b328e9f9305bc","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/37791/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/37791/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/37791/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/3e5802db196f1ed3bd0327605c603f57cf069fca","head":{"label":"petrochenkov:where","ref":"where","sha":"3e5802db196f1ed3bd0327605c603f57cf069fca","user":{"login":"petrochenkov","id":5751617,"avatar_url":"https://avatars.githubusercontent.com/u/5751617?v=3","gravatar_id":"","url":"https://api.github.com/users/petrochenkov","html_url":"https://github.com/petrochenkov","followers_url":"https://api.github.com/users/petrochenkov/followers","following_url":"https://api.github.com/users/petrochenkov/following{/other_user}","gists_url":"https://api.github.com/users/petrochenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/petrochenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrochenkov/subscriptions","organizations_url":"https://api.github.com/users/petrochenkov/orgs","repos_url":"https://api.github.com/users/petrochenkov/repos","events_url":"https://api.github.com/users/petrochenkov/events{/privacy}","received_events_url":"https://api.github.com/users/petrochenkov/received_events","type":"User","site_admin":false},"repo":{"id":26977039,"name":"rust","full_name":"petrochenkov/rust","owner":{"login":"petrochenkov","id":5751617,"avatar_url":"https://avatars.githubusercontent.com/u/5751617?v=3","gravatar_id":"","url":"https://api.github.com/users/petrochenkov","html_url":"https://github.com/petrochenkov","followers_url":"https://api.github.com/users/petrochenkov/followers","following_url":"https://api.github.com/users/petrochenkov/following{/other_user}","gists_url":"https://api.github.com/users/petrochenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/petrochenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrochenkov/subscriptions","organizations_url":"https://api.github.com/users/petrochenkov/orgs","repos_url":"https://api.github.com/users/petrochenkov/repos","events_url":"https://api.github.com/users/petrochenkov/events{/privacy}","received_events_url":"https://api.github.com/users/petrochenkov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petrochenkov/rust","description":"a safe, concurrent, practical language","fork":true,"url":"https://api.github.com/repos/petrochenkov/rust","forks_url":"https://api.github.com/repos/petrochenkov/rust/forks","keys_url":"https://api.github.com/repos/petrochenkov/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petrochenkov/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petrochenkov/rust/teams","hooks_url":"https://api.github.com/repos/petrochenkov/rust/hooks","issue_events_url":"https://api.github.com/repos/petrochenkov/rust/issues/events{/number}","events_url":"https://api.github.com/repos/petrochenkov/rust/events","assignees_url":"https://api.github.com/repos/petrochenkov/rust/assignees{/user}","branches_url":"https://api.github.com/repos/petrochenkov/rust/branches{/branch}","tags_url":"https://api.github.com/repos/petrochenkov/rust/tags","blobs_url":"https://api.github.com/repos/petrochenkov/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petrochenkov/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petrochenkov/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/petrochenkov/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petrochenkov/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/petrochenkov/rust/languages","stargazers_url":"https://api.github.com/repos/petrochenkov/rust/stargazers","contributors_url":"https://api.github.com/repos/petrochenkov/rust/contributors","subscribers_url":"https://api.github.com/repos/petrochenkov/rust/subscribers","subscription_url":"https://api.github.com/repos/petrochenkov/rust/subscription","commits_url":"https://api.github.com/repos/petrochenkov/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/petrochenkov/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/petrochenkov/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/petrochenkov/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/petrochenkov/rust/contents/{+path}","compare_url":"https://api.github.com/repos/petrochenkov/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petrochenkov/rust/merges","archive_url":"https://api.github.com/repos/petrochenkov/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petrochenkov/rust/downloads","issues_url":"https://api.github.com/repos/petrochenkov/rust/issues{/number}","pulls_url":"https://api.github.com/repos/petrochenkov/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/petrochenkov/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/petrochenkov/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petrochenkov/rust/labels{/name}","releases_url":"https://api.github.com/repos/petrochenkov/rust/releases{/id}","deployments_url":"https://api.github.com/repos/petrochenkov/rust/deployments","created_at":"2014-11-21T20:39:20Z","updated_at":"2016-01-14T18:00:04Z","pushed_at":"2016-11-16T19:28:05Z","git_url":"git://github.com/petrochenkov/rust.git","ssh_url":"git@github.com:petrochenkov/rust.git","clone_url":"https://github.com/petrochenkov/rust.git","svn_url":"https://github.com/petrochenkov/rust","homepage":"http://www.rust-lang.org","size":307982,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"478c0d161498c9bd0ee89a7b205e7b2f2437f151","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-11-16T18:19:42Z","pushed_at":"2016-11-16T20:14:00Z","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":525211,"stargazers_count":19013,"watchers_count":19013,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3653,"mirror_url":null,"open_issues_count":2870,"forks":3653,"open_issues":2870,"watchers":19013,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/37791"},"html":{"href":"https://github.com/rust-lang/rust/pull/37791"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/37791"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/37791/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/37791/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/37791/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/3e5802db196f1ed3bd0327605c603f57cf069fca"}}}}
{"actor":{"display_login":"arielb1"}}