{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/22486","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/22486/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/22486/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/22486/events","html_url":"https://github.com/rust-lang/rust/issues/22486","id":58070372,"number":22486,"title":"Namespaced enums are weird in regard to generic paramters","user":{"login":"Kimundi","id":2903206,"avatar_url":"https://avatars.githubusercontent.com/u/2903206?v=3","gravatar_id":"","url":"https://api.github.com/users/Kimundi","html_url":"https://github.com/Kimundi","followers_url":"https://api.github.com/users/Kimundi/followers","following_url":"https://api.github.com/users/Kimundi/following{/other_user}","gists_url":"https://api.github.com/users/Kimundi/gists{/gist_id}","starred_url":"https://api.github.com/users/Kimundi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kimundi/subscriptions","organizations_url":"https://api.github.com/users/Kimundi/orgs","repos_url":"https://api.github.com/users/Kimundi/repos","events_url":"https://api.github.com/users/Kimundi/events{/privacy}","received_events_url":"https://api.github.com/users/Kimundi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-nominated","name":"I-nominated","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rust-lang/rust/milestones/22","html_url":"https://github.com/rust-lang/rust/milestones/1.0%20beta","labels_url":"https://api.github.com/repos/rust-lang/rust/milestones/22/labels","id":924511,"number":22,"title":"1.0 beta","description":"","creator":{"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},"open_issues":36,"closed_issues":33,"state":"open","created_at":"2015-01-06T21:40:55Z","updated_at":"2015-02-26T21:19:56Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-02-18T13:56:11Z","updated_at":"2015-02-26T21:19:56Z","closed_at":null,"body":"Enum variants are namespaced now, but applying generic paramters to them in expressions still works as before, which means the correct way to type annotate a `Option` in a expression is to do this:\r\n\r\n```rust\r\nenum Option<T> {\r\n    Some(T),\r\n    None\r\n}\r\nlet x = Option::Some::<u32>(1);\r\n```\r\n\r\nHowever, this is inconsistent with other namespaced constructs, like this:\r\n\r\n```rust\r\nstruct Foo<T>(T);\r\nimpl<T> Foo<T> { fn new(t:T) -> Foo<T> { Foo(t) } }\r\n\r\nlet x = Foo::<u32>::new(1);\r\n\r\n// With UFCS\r\nlet f = Option::<u32>::and as fn(Option<u32>, Option<u32>) -> Option<u32>;\r\n```\r\n\r\n\r\nGenerally, type parameters of an item are supposed to go on that item in a path, but for enum variants this is not the case.\r\n\r\nAs a backward compatible solution to this, enum variants could be made to work similar to associated items of traits:\r\n\r\n```rust\r\nOption::Some      // Generic item fn<T>(T) -> Option<T>\r\nOption::<T>::Some // Concrete instantiated item fn(T) -> Option<T>\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/76275791","html_url":"https://github.com/rust-lang/rust/issues/22486#issuecomment-76275791","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/22486","id":76275791,"user":{"login":"pnkfelix","id":173127,"avatar_url":"https://avatars.githubusercontent.com/u/173127?v=3","gravatar_id":"","url":"https://api.github.com/users/pnkfelix","html_url":"https://github.com/pnkfelix","followers_url":"https://api.github.com/users/pnkfelix/followers","following_url":"https://api.github.com/users/pnkfelix/following{/other_user}","gists_url":"https://api.github.com/users/pnkfelix/gists{/gist_id}","starred_url":"https://api.github.com/users/pnkfelix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnkfelix/subscriptions","organizations_url":"https://api.github.com/users/pnkfelix/orgs","repos_url":"https://api.github.com/users/pnkfelix/repos","events_url":"https://api.github.com/users/pnkfelix/events{/privacy}","received_events_url":"https://api.github.com/users/pnkfelix/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T21:19:53Z","updated_at":"2015-02-26T21:19:53Z","body":"@alexcrichton points out that it is *nice* to write `None::<T>`\r\n\r\nBut it does seem like an inconsistency, i.e. a wart.\r\n\r\nP-backcompat-libs, 1.0 beta, I-needs-decision."}}