{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/44721","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/44721/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/44721/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/44721/events","html_url":"https://github.com/rust-lang/rust/issues/44721","id":259235940,"number":44721,"title":"impl Trait in argument position ","user":{"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},"labels":[{"id":631673608,"url":"https://api.github.com/repos/rust-lang/rust/labels/A-impl-trait","name":"A-impl-trait","color":"d7e102","default":false},{"id":650846969,"url":"https://api.github.com/repos/rust-lang/rust/labels/C-tracking-issue","name":"C-tracking-issue","color":"f5f1fd","default":false},{"id":67766349,"url":"https://api.github.com/repos/rust-lang/rust/labels/E-mentor","name":"E-mentor","color":"02E10C","default":false},{"id":705882277,"url":"https://api.github.com/repos/rust-lang/rust/labels/hacktoberfest","name":"hacktoberfest","color":"FFA500","default":false},{"id":211668100,"url":"https://api.github.com/repos/rust-lang/rust/labels/T-compiler","name":"T-compiler","color":"bfd4f2","default":false},{"id":693665284,"url":"https://api.github.com/repos/rust-lang/rust/labels/WG-compiler-middle","name":"WG-compiler-middle","color":"c2e0c6","default":false},{"id":693557542,"url":"https://api.github.com/repos/rust-lang/rust/labels/WG-compiler-traits","name":"WG-compiler-traits","color":"c2e0c6","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2017-09-20T17:06:04Z","updated_at":"2017-10-03T15:51:24Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"As part of the latest `impl Trait` RFC, we decided to accept `impl Trait` in argument position:\r\n\r\n```rust\r\nfn foo(x: impl Iterator<Item = u32>) {\r\n    ...\r\n}\r\n```\r\n\r\nthis is roughly equivalent to `fn foo<T: Iterator<Item = u32>>(t: T)`, except that explicitly specifying the type is not permitted (i.e., `foo::<u32>` is an error). \r\n\r\n[Mentoring instructions can be found here.](https://github.com/rust-lang/rust/issues/44721#issuecomment-330945507)\r\n\r\nQuestions to resolve:\r\n\r\n- Should we permit specifying types if some parameters are implicit and some are explicit? e.g., `fn foo<T>(x: impl Iterator<Item = T>>)`? I think **yes**, `foo::<u32>` would be accepted (thus binding `T = u32` explicitly).\r\n    - Answer: for now, just forbid explicit bindings altogether in the presence of `impl Trait` arguments."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/333886151","html_url":"https://github.com/rust-lang/rust/issues/44721#issuecomment-333886151","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/44721","id":333886151,"user":{"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},"created_at":"2017-10-03T15:51:24Z","updated_at":"2017-10-03T15:51:24Z","author_association":"CONTRIBUTOR","body":"@mdevlamynck \r\n\r\n> Do you think the conversion should be handled here?\r\n\r\nMy expectation, I think, was that we would, during HIR lowering, no longer produce an impl trait in that position. \r\n\r\nI am not 100% sure that this is the best route. Another possibility would be to handle this during the \"ty queries\" construction. In more detail, HIR lowering produces a kind of AST, but then there are various queries that produce the \"semantic view\" of that AST. For example, there is a `hir::Generics`, which represents basically \"what the user wrote\". The way that I was starting down involved editing that `hir::Generics` to insert synthetic items.\r\n\r\nBut there is a [query](https://github.com/rust-lang/rust/blob/master/src/librustc/ty/maps/README.md) that creates a `ty::Generics` from that `hir::Generics`, and that's what the type system internally uses. So we could leave the `hir::Generics` unchanged but instead scrape the types of the arguments when constructing the `ty::Generics`."}}
{"actor":{"display_login":"nikomatsakis"}}