{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/39272","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/39272/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/39272/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/39272/events","html_url":"https://github.com/rust-lang/rust/issues/39272","id":202904253,"number":39272,"title":"Wrong compiler help when using self from trait as type parameter","user":{"login":"torkleyy","id":23152057,"avatar_url":"https://avatars.githubusercontent.com/u/23152057?v=3","gravatar_id":"","url":"https://api.github.com/users/torkleyy","html_url":"https://github.com/torkleyy","followers_url":"https://api.github.com/users/torkleyy/followers","following_url":"https://api.github.com/users/torkleyy/following{/other_user}","gists_url":"https://api.github.com/users/torkleyy/gists{/gist_id}","starred_url":"https://api.github.com/users/torkleyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torkleyy/subscriptions","organizations_url":"https://api.github.com/users/torkleyy/orgs","repos_url":"https://api.github.com/users/torkleyy/repos","events_url":"https://api.github.com/users/torkleyy/events{/privacy}","received_events_url":"https://api.github.com/users/torkleyy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-01-24T18:40:36Z","updated_at":"2017-01-24T19:17:45Z","closed_at":"2017-01-24T19:17:45Z","body":"If I want to use `Self` in a trait as type parameter, and `Self` does not fulfill the requirements, the help message is not correct.\r\n\r\n## Minimal example\r\n\r\n```rust\r\n// T has automatically a trait bound on `std::marker::Sized`\r\nstruct Bar<T>(T);\r\n\r\ntrait Foo {\r\n    // Foo may or may not have `std::marker::Sized`\r\n    fn foo() -> Bar<Self>;\r\n}\r\n```\r\n\r\n## Compiler output\r\n\r\n```\r\nerror[E0277]: the trait bound `Self: std::marker::Sized` is not satisfied\r\n --> <anon>:6:5\r\n  |\r\n6 |     fn foo() -> Bar<Self>;\r\n  |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Sized` is not implemented for `Self`\r\n  |\r\n  = help: consider adding a `where Self: std::marker::Sized` bound\r\n  = note: required by `Bar`\r\n```\r\n\r\nHowever, you cannot have a `where` clause on a trait.\r\n\r\n## Expected output\r\n\r\n```\r\nerror[E0277]: the trait bound `Self: std::marker::Sized` is not satisfied\r\n --> <anon>:6:5\r\n  |\r\n6 |     fn foo() -> Bar<Self>;\r\n  |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Sized` is not implemented for `Self`\r\n  |\r\n  = help: consider adding a `std::marker::Sized` bound to your trait\r\n  = note: required by `Bar`\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/274906770","html_url":"https://github.com/rust-lang/rust/issues/39272#issuecomment-274906770","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/39272","id":274906770,"user":{"login":"torkleyy","id":23152057,"avatar_url":"https://avatars.githubusercontent.com/u/23152057?v=3","gravatar_id":"","url":"https://api.github.com/users/torkleyy","html_url":"https://github.com/torkleyy","followers_url":"https://api.github.com/users/torkleyy/followers","following_url":"https://api.github.com/users/torkleyy/following{/other_user}","gists_url":"https://api.github.com/users/torkleyy/gists{/gist_id}","starred_url":"https://api.github.com/users/torkleyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torkleyy/subscriptions","organizations_url":"https://api.github.com/users/torkleyy/orgs","repos_url":"https://api.github.com/users/torkleyy/repos","events_url":"https://api.github.com/users/torkleyy/events{/privacy}","received_events_url":"https://api.github.com/users/torkleyy/received_events","type":"User","site_admin":false},"created_at":"2017-01-24T19:17:45Z","updated_at":"2017-01-24T19:17:45Z","body":"What? I don't know what I did before, but what I did didn't work. Well, I guess I can close the issue..."}}
{"actor":{"display_login":"torkleyy"}}