{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/24680","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/24680/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/24680/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/24680/events","html_url":"https://github.com/rust-lang/rust/issues/24680","id":70022600,"number":24680,"title":"Incomprehensible error message when inference fails for closure","user":{"login":"seanmonstar","id":51479,"avatar_url":"https://avatars.githubusercontent.com/u/51479?v=3","gravatar_id":"","url":"https://api.github.com/users/seanmonstar","html_url":"https://github.com/seanmonstar","followers_url":"https://api.github.com/users/seanmonstar/followers","following_url":"https://api.github.com/users/seanmonstar/following{/other_user}","gists_url":"https://api.github.com/users/seanmonstar/gists{/gist_id}","starred_url":"https://api.github.com/users/seanmonstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanmonstar/subscriptions","organizations_url":"https://api.github.com/users/seanmonstar/orgs","repos_url":"https://api.github.com/users/seanmonstar/repos","events_url":"https://api.github.com/users/seanmonstar/events{/privacy}","received_events_url":"https://api.github.com/users/seanmonstar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-closures","name":"A-closures","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-diagnostics","name":"A-diagnostics","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-typesystem","name":"A-typesystem","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/P-high","name":"P-high","color":"eb6420"}],"state":"open","locked":false,"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,"comments":16,"created_at":"2015-04-22T04:45:20Z","updated_at":"2016-05-31T19:38:53Z","closed_at":null,"body":"```rust\r\nstruct Foo<'a> {\r\n    _s: &'a str\r\n}\r\n\r\nstruct Bar<H: Handler> {\r\n    handler: H\r\n}\r\n\r\ntrait Handler {\r\n    fn handle<'a>(&'a self, foo: Foo<'a>);\r\n}\r\n\r\nimpl<F> Handler for F where F: Fn(Foo) {\r\n    fn handle<'a>(&'a self, foo: Foo<'a>) {\r\n        self(foo)\r\n    }\r\n}\r\n\r\nfn main() {\r\n    let foo = Foo { _s: \"foo\" };\r\n    let bar = Bar { handler: |_f /*: Foo*/| {} }; // uncomment to work\r\n    (bar.handler)(foo);\r\n}\r\n```\r\n\r\nGives:\r\n```\r\nerror: type mismatch: the type `[closure test.rs:8:23: 20:6]` implements the trait `core::ops::Fn<(_, _)>`, but the trait `for<'r,'r,'r> core::ops::Fn<(hyper::server::request::Request\r\n<'r, 'r>, hyper::server::response::Response<'r>)>` is required (expected concrete lifetime, found bound lifetime parameter ) [E0281]\r\n```\r\n\r\nPlaypen: http://is.gd/E7sskd\r\n\r\nCouldn't tell if this was #16473, @reem thinks it might be different. Either way, this hurts using hyper's server easily: `Server::http(|req, res| {}).listen(8080)`."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/222796972","html_url":"https://github.com/rust-lang/rust/issues/24680#issuecomment-222796972","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/24680","id":222796972,"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},"created_at":"2016-05-31T19:38:53Z","updated_at":"2016-05-31T19:38:53Z","body":"@shepmaster well my feeling is that there are various intersecting problems here. First off, our output is pretty hard to read in general (because we don't do a good job \"desugaring\" the fn traits and so forth). Second, we don't handle higher-ranked messages very well. Finally, and least likely to be fixed, the inference has some limitations. So probably the answer is \"yes\", but maybe the right thing is to try and separate out the various problems into distinct issues that are more specific."}}
{"actor":{"display_login":"nikomatsakis"}}