{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/30811417","id":30811417,"diff_hunk":"@@ -3763,8 +3763,36 @@ pub fn resolve_ty_and_def_ufcs<'a, 'b, 'tcx>(fcx: &FnCtxt<'b, 'tcx>,\n                                                         &'a [ast::PathSegment],\n                                                         def::Def)>\n {\n+\n+    // Associated constants can't depend on generic types.\n+    fn have_disallowed_generic_consts<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,\n+                                                def: def::Def,\n+                                                ty: Ty<'tcx>,\n+                                                span: Span,\n+                                                node_id: ast::NodeId) -> bool {\n+        match def {\n+            def::DefAssociatedConst(..) => {\n+                if ty::type_has_params(ty) || ty::type_has_self(ty) {\n+                    fcx.sess().span_err(span,\n+                                        \"Associated consts cannot depend \\\n+                                         on type parameters or Self.\");","path":"src/librustc_typeck/check/mod.rs","position":16,"original_position":16,"commit_id":"98f41ff3555dba80b47ebee6f6bc8a7df697240c","original_commit_id":"98f41ff3555dba80b47ebee6f6bc8a7df697240c","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":"can you add a diagnostic (and associated code) use the `span_err!` macro?","created_at":"2015-05-21T15:07:12Z","updated_at":"2015-05-21T15:07:12Z","html_url":"https://github.com/rust-lang/rust/pull/25091#discussion_r30811417","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/25091","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/30811417"},"html":{"href":"https://github.com/rust-lang/rust/pull/25091#discussion_r30811417"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/25091"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/25091","id":34621072,"html_url":"https://github.com/rust-lang/rust/pull/25091","diff_url":"https://github.com/rust-lang/rust/pull/25091.diff","patch_url":"https://github.com/rust-lang/rust/pull/25091.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/25091","number":25091,"state":"open","locked":false,"title":"Trait-associated const fixes","user":{"login":"quantheory","id":1740206,"avatar_url":"https://avatars.githubusercontent.com/u/1740206?v=3","gravatar_id":"","url":"https://api.github.com/users/quantheory","html_url":"https://github.com/quantheory","followers_url":"https://api.github.com/users/quantheory/followers","following_url":"https://api.github.com/users/quantheory/following{/other_user}","gists_url":"https://api.github.com/users/quantheory/gists{/gist_id}","starred_url":"https://api.github.com/users/quantheory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantheory/subscriptions","organizations_url":"https://api.github.com/users/quantheory/orgs","repos_url":"https://api.github.com/users/quantheory/repos","events_url":"https://api.github.com/users/quantheory/events{/privacy}","received_events_url":"https://api.github.com/users/quantheory/received_events","type":"User","site_admin":false},"body":"Closes #25046 (by rejecting the code that causes the ICE) and #24946. I haven't been able to deal with the array size or recursion issues yet for associated consts, though my hope was that the change I made for range match patterns might help with array sizes, too.\r\n\r\nThis PR is pretty much orthogonal to #25065.","created_at":"2015-05-04T08:08:19Z","updated_at":"2015-05-21T15:07:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c45ca89f940d0a013437a4bce4b8e1f9730ede99","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},"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/25091/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/25091/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/25091/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/98f41ff3555dba80b47ebee6f6bc8a7df697240c","head":{"label":"quantheory:trait_associated_const_fixes","ref":"trait_associated_const_fixes","sha":"98f41ff3555dba80b47ebee6f6bc8a7df697240c","user":{"login":"quantheory","id":1740206,"avatar_url":"https://avatars.githubusercontent.com/u/1740206?v=3","gravatar_id":"","url":"https://api.github.com/users/quantheory","html_url":"https://github.com/quantheory","followers_url":"https://api.github.com/users/quantheory/followers","following_url":"https://api.github.com/users/quantheory/following{/other_user}","gists_url":"https://api.github.com/users/quantheory/gists{/gist_id}","starred_url":"https://api.github.com/users/quantheory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantheory/subscriptions","organizations_url":"https://api.github.com/users/quantheory/orgs","repos_url":"https://api.github.com/users/quantheory/repos","events_url":"https://api.github.com/users/quantheory/events{/privacy}","received_events_url":"https://api.github.com/users/quantheory/received_events","type":"User","site_admin":false},"repo":{"id":29286561,"name":"rust","full_name":"quantheory/rust","owner":{"login":"quantheory","id":1740206,"avatar_url":"https://avatars.githubusercontent.com/u/1740206?v=3","gravatar_id":"","url":"https://api.github.com/users/quantheory","html_url":"https://github.com/quantheory","followers_url":"https://api.github.com/users/quantheory/followers","following_url":"https://api.github.com/users/quantheory/following{/other_user}","gists_url":"https://api.github.com/users/quantheory/gists{/gist_id}","starred_url":"https://api.github.com/users/quantheory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantheory/subscriptions","organizations_url":"https://api.github.com/users/quantheory/orgs","repos_url":"https://api.github.com/users/quantheory/repos","events_url":"https://api.github.com/users/quantheory/events{/privacy}","received_events_url":"https://api.github.com/users/quantheory/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/quantheory/rust","description":"a safe, concurrent, practical language","fork":true,"url":"https://api.github.com/repos/quantheory/rust","forks_url":"https://api.github.com/repos/quantheory/rust/forks","keys_url":"https://api.github.com/repos/quantheory/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quantheory/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quantheory/rust/teams","hooks_url":"https://api.github.com/repos/quantheory/rust/hooks","issue_events_url":"https://api.github.com/repos/quantheory/rust/issues/events{/number}","events_url":"https://api.github.com/repos/quantheory/rust/events","assignees_url":"https://api.github.com/repos/quantheory/rust/assignees{/user}","branches_url":"https://api.github.com/repos/quantheory/rust/branches{/branch}","tags_url":"https://api.github.com/repos/quantheory/rust/tags","blobs_url":"https://api.github.com/repos/quantheory/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quantheory/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quantheory/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/quantheory/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quantheory/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/quantheory/rust/languages","stargazers_url":"https://api.github.com/repos/quantheory/rust/stargazers","contributors_url":"https://api.github.com/repos/quantheory/rust/contributors","subscribers_url":"https://api.github.com/repos/quantheory/rust/subscribers","subscription_url":"https://api.github.com/repos/quantheory/rust/subscription","commits_url":"https://api.github.com/repos/quantheory/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/quantheory/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/quantheory/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/quantheory/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/quantheory/rust/contents/{+path}","compare_url":"https://api.github.com/repos/quantheory/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quantheory/rust/merges","archive_url":"https://api.github.com/repos/quantheory/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quantheory/rust/downloads","issues_url":"https://api.github.com/repos/quantheory/rust/issues{/number}","pulls_url":"https://api.github.com/repos/quantheory/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/quantheory/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/quantheory/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quantheory/rust/labels{/name}","releases_url":"https://api.github.com/repos/quantheory/rust/releases{/id}","created_at":"2015-01-15T07:48:08Z","updated_at":"2015-05-03T22:03:00Z","pushed_at":"2015-05-17T22:01:25Z","git_url":"git://github.com/quantheory/rust.git","ssh_url":"git@github.com:quantheory/rust.git","clone_url":"https://github.com/quantheory/rust.git","svn_url":"https://github.com/quantheory/rust","homepage":"http://www.rust-lang.org","size":290488,"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":"8b7c17db2235a2a3f2c71242b11fc429a8d05a90","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}","created_at":"2010-06-16T20:39:03Z","updated_at":"2015-05-21T14:47:13Z","pushed_at":"2015-05-21T13:00:05Z","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":659387,"stargazers_count":11630,"watchers_count":11630,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2229,"mirror_url":null,"open_issues_count":2056,"forks":2229,"open_issues":2056,"watchers":11630,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/25091"},"html":{"href":"https://github.com/rust-lang/rust/pull/25091"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/25091"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/25091/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/25091/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/25091/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/98f41ff3555dba80b47ebee6f6bc8a7df697240c"}}}}